Newest 'spring' Questions - Stack Overflow

Questions tagged [spring]

The Spring Framework is an open source framework for application development on the Java platform. At its core is rich support for component-based architectures, and it currently has over twenty highly integrated modules.

0
votes
0answers
6 views

Spring template doesn't load after maven package

When I run my spring application by eclipse it works fine, but when I build my jar and run it, the template can't be found by spring, why? http://prntscr.com/o4i7q3 I don't get any whitelabel when I ...
-2
votes
0answers
22 views

what is track to learn spring framework in java [on hold]

i learn java basics (fundamentals, OOP concepts, swing, javaFX basic and data structures). Now i want to learn spring framework. I start learning spring but there are lot of concepts like AOP, DI, ...
0
votes
0answers
7 views

How to force RequestMapping redirect to respect the calling URL's protocol. (HTTPS/HTTP)

Scenario: I have a redirect for the swagger-ui pages to make it easier to get to. (camel makes me sad) When I'm running locally, I am using HTTP. When I'm running in the test servers, I am using ...
0
votes
1answer
15 views

Logging which Spring AOP

I am trying to add log for my api but I have a question in my code about aspects. My project has the follwing structure , the classical structure controller and service com.surname.apiproject....
0
votes
0answers
11 views

Suppression of JSESSIONID cookie with Logback dependencies

I want to ensure that JSessionID cookies are never created ... from my understanding this can easily be done by setting Session Creation Policy to Stateless. Example: public class ...
1
vote
0answers
10 views

Thymeleaf dynamic form action does not work

I am loading the home.html page by setting the following model attributes: @GetMapping("/") private String getHomePage(Model model) { model.addAttribute("allUsers", this.userService.findAll()); ...
0
votes
2answers
22 views

Mocking a void method in the Spring Framework (Mockito)

I'm writing integration tests for a spring web app and I have reached a step where I need to mock service methods calls which have a void return type. I've done some research on some ways to do this ...
0
votes
0answers
8 views

Spring Boot 2 enrich metric http.server.requests with number of requests per second

Im using Spring Boot 2 and in particular I need to add a new measurement under http://localhost:8080/actuator/metrics/http.server.requests which now has only the default measurements { "name": "http....
0
votes
1answer
11 views

Having Issues Mocking “marshalSendandReceive” method call in Mockito

I'm trying to create some unit tests in Mockito, and mocking a WebServiceTemplate call that returns a JAXBElement. I continually run into a NullPointerException, along with internal Mockito errors. ...
0
votes
0answers
11 views

Unable to use Aspect around over a method

This is in a Spring project where I have Aspect setup in a different module on which other modules are dependant on. I am using custom annotations. It works fine on some methods but not on others. ...
0
votes
0answers
7 views

How to call multiple step/tasklet in one step in Spring Batch

I have a spring batch job, such as follow: <!-- 4 Tasklets --> <batch:tasklet ref="ATasklet"/> <batch:tasklet ref="BTasklet"/> <batch:tasklet ref="CTasklet"/> <batch:...
0
votes
0answers
19 views

Testing starter with Springboot+JUnit

I have a custom library (a starter) created with SpringBoot. So, it doesn't have main method or @SpringBootApplication annotated class. I want to test this starter functionality with JUnit. I have ...
0
votes
0answers
7 views

Bad credential with spring cloud config server when security is enable

I create a spring cloud config server. I put security. In my application.properties file security.basic.enabled=false security.user.name=1user security.user.password=123 When i try to log to the ...
0
votes
0answers
16 views

How to get JSON metadata of a class in Spring Boot

I'm trying to get metadata in JSON format of a class in Spring Boot, but I don't really know how to start. I have created my class, that is a random one, just to make some attempt. Can someone show me ...
0
votes
2answers
26 views

how to get unique row in sql from one column which same value in JPA?

I have a contract which has 2 different names but has the same number, and I really want to get only one result which that phone number show up for my result though their name is different example, ...
-1
votes
0answers
25 views

What is more preferable: usage of HttpClient or HttpClientAutoconfiguration and why? [on hold]

I am using Spring Framework and trying to figure out what is more preferable: usage of HttpClient or HttpClientAutoconfiguration and why?
0
votes
1answer
16 views

Spring dependency injection with duplicate beans and @Order annotation

I am moderately confused about the DI injection mechanism in Spring when having multiple beans with the same name/type. According to the exam slides from the Pivotal's "Core Spring" Course, Spring's ...
0
votes
0answers
10 views

Spring/JUnit/Mockito: How do I inject a value that is @Value annotated into a mocked bean? [duplicate]

Background: Java 8 (1.8.0_201) Spring Boot Mockito (2.23.4) I have a number of JUnit tests written for our software application and am in the middle of refactoring/fixing test failures due to ...
0
votes
0answers
11 views

While trying to access to oauth2 server, receiving Insufficient scope exception

Currently, I am developing a backend server using Spring boot framework. When I am trying to retrieve an access token from the oauth2 server. I got AccessDeniedException: Insufficient scope for this ...
0
votes
0answers
8 views

spring-mvc: return ResponseEntity<byte[]> with content-type as json

I'm working on a Spring-MVC rest API, and one one our service must allow device clients to download some data: json or deflated json, on demand. But the data that our service expose comes from a ...
0
votes
0answers
9 views

Call to REST API gives Internal Server Error, How to Debug?

I have Spring MVC application, which I have build. The output or artifact is WAR file. The WAR file is deployed successfully in the WildFly. But when I make call to API, it throws the Internal Server ...
-2
votes
2answers
11 views

Map Json to POJO class using Rest Template exchange method

This is my POST request to an API ResponseEntity<String> result = rt.exchange(url, HttpMethod.POST, httpEntity, String.class); The response i am getting is below { "headers": { "...
-1
votes
1answer
27 views

How to iterate list of objects in spring thymeleaf

public class Members { private String fname; private String lname; public String getFname() { return fname; } public void setFname(String fname) { this....
-1
votes
1answer
17 views

In Spring DAO javax.transaction.Transactional BUT in Spring Service org.springframework.transaction.annotation.Transactional [on hold]

In our Spring-Boot project I can see, @Transactional of Spring ( org.springframework.transaction.annotation.Transactional ) has been used in Service class and in DAO class (Repository class) @...
0
votes
0answers
11 views

Not annotated parameter overrides @??? parameter

While overriding code: @Override public void open(ExecutionContext executionContext) { super.open(executionContext); from: org.springframework.batch.item.support....
0
votes
0answers
7 views

CastorMapping for marshalling and unmarshalling for tag xsi:nil=“true”

what will be configuration for handling xsi:nil="true" in castor mapping file, i am using org.springframework.oxm.castor.CastorMarshaller below is problem, I have response <soapenv:Envelope ...
-1
votes
0answers
11 views

Spring Jpa Generic with all feature [on hold]

As a newbee, I need an example for reference how to implement Spring JPA generic for all entities with the transactionality, Please help me with example
0
votes
0answers
20 views

Injection fails because bean cannot be found [duplicate]

I'm trying to develop a very simple, basic RESTful web service with a controller-service-dao-entity architecture using Spring Boot, but my application won't start because the injection of my dao class ...
0
votes
0answers
22 views

Set spring properties file location from command line

I have a simple Spring application with reading configuration values from a properties file. The file is configured to be on classpath by default (@PropertySource("classpath:thefile.properties") ...
0
votes
0answers
15 views

Secure controller access in Spring MVC

In my application, I need to secure controller access with Spring Security In particular, I would like to allow / disallow the access to all controller methods to users based on grants. Here is an ...
1
vote
1answer
20 views

jquety.text() unable to compare wih the given string

I have a spring boot app where I have implemented role-based authentication. Once the end user is authenticated the menu from the database should load as per the role. Once successfully authentication ...
-3
votes
1answer
23 views

What is the difference between Spring and SpringBoot? [duplicate]

Please Explain me the exact difference between the spring and spring boot?
0
votes
0answers
12 views

Getting java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter

I have upgraded spring version in my appliation from 4.3.18.RELEASE to 5.1.5.RELEASE and now getting deployment error: java.lang.ClassNotFoundException: org.springframework.web.servlet.mvc.annotation....
0
votes
1answer
17 views

@DateTimeFormat annotation in entity/document class

I need to map string from mongo to LocalDateTime in entity class. Date in mongo is stored as string, not ISODate. eg. 2015-02-05 10:10:10 I tried to use @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss"...
1
vote
2answers
27 views

How to link two objects of different classes?

I want to build a REST API for a library (endpoints are customers and invoices). One of the features is to add an invoice (PUT request with customer id). Firstly I have to check if the passed customer ...
0
votes
0answers
9 views

Copy properties from source to target class using beanutils.properties method

I have a source class Entity having some params and a target class Dto class. Now, Entity class is having params of some other class but in dto class I'm using those params directly not using the ...
2
votes
1answer
28 views

how to set spring.config.location for a gradle spring boot project in Intellij IDEA community version?

I want to configure spring.config.location or spring.config.additional-location in a Java Spring Boot project using Gradle in my Intellij IDEA community version. It is run in the IDE clicking the ...
0
votes
1answer
19 views

Log4j to enable dynamically based on environment

I have a requirements to enable the console logs for Dev and SIT instances but not in production. Like if(ENV=SIT) do logging otherwise not And this should be dynamic so if requires I can enable ...
1
vote
2answers
52 views

Spring container doesn't inject dependencies after the introduction of the aspect

The project worked well before using AOP, but after adding the LoggingAspect class, a NullPointerException appeared. I did the project debugging and at the point where the NullPointerException appears,...
0
votes
1answer
14 views

Spring Restdocs response payload contains optional empty list of objects

My JSON response payload looks like this: { "count": 2, "items": [ { "k1": "v1", "k2": [] }, { "k1": "v2", "k2": [ { "name": "joe" }, ...
0
votes
0answers
16 views

How to turn on oracle profiling when calling spring stored procedure

We have a java based monolithic web application that uses Oracle as the data store. We want to start Oracle DBMS_PROFILER before calling any stored procedure from our java application. This requires ...
1
vote
0answers
17 views

Converter/Formatted method Not Work Perfectly After JDK version change to 8 to 12

recently i change jdk version 8 to 12 in my sprint web application. application run ok but converter/Formatted related method return unexpected result. problem example: input data .007 to format in 2 ...
1
vote
0answers
35 views

Avoid Spring Data JPA Selections before Saving an Entity

Here is the scenario, I'm saving an entity(let's call it as CG entity) using Spring Data JPA JpaRepository. In this CG entity, we have so many entities One-One, One-Many and M-M and inside these ...
0
votes
0answers
19 views

Adding Custom Validation in Jhipster User Authentication

Since Jhipster(Angular + Springboot Scaffolding) uses JWT for authentication, we have a custom login model which checks user authentication. Now the code goes something like this(UserJWTController....
1
vote
1answer
26 views

What is the meaning of set of values in log emitted by Spring Boot application?

I am using spring boot for creating microservices. One of the log generated is: 2019-06-19 09:31:05.875 INFO [tkc,37b5f215d418d0ff,d5501f25ae8599bf,false] 13 --- [ntainer#0-1-C-1] a.b.c.d....
2
votes
1answer
20 views

Required String parameter is not present : communicate with fetch

I am trying to use fetch API to remove JQuery from my code and I have an issue sending the data to the server : Here is my function : url = '/authentication' fetch(url, { method: 'POST', ...
0
votes
1answer
19 views

LocalTime(00:01:002) turns to (24:00:02) after saving to ElasticSearch by Spring data elasticsearch repo

when I save the LocalTime object with Spring Data ElasticSearch repository interface, I find the data in ElasticSearch changed unexpectedly,the LocalTime with Value "00:01:01" changed to "24:01:01". ...
-1
votes
0answers
25 views

(Spring, Oracle) HTTP Status 500 – Internal Server Error

There is Internal Server Error in a spring project which I'm using. this spring connected to Oracle DB. and it show me it's main page, but when I click any link in main page, I get HTTP 500 error. ...
-6
votes
0answers
24 views

JSESSIONID=SESSION_ID ! PRIMARY_JVMID_HASH ! SECONDARY_JVM_HASH ! CREATION_TIME [on hold]

where i have to use JSESSIONID=SESSION_ID ! PRIMARY_JVMID_HASH ! SECONDARY_JVM_HASH ! CREATION_TIME which location i have to implement that because cookies value is not comming randomely
0
votes
0answers
29 views

Doubts about spring controller method annotations

First, i've configured my spring servlet with: alwaysUseFullPath : true useTrailingSlashMatch : false useSuffixPatternMatch : false What i don't understand is how spring resolve my mappings where ...