I want to return an ETag header, but my Client cannot read it because it is not exposed. I have the following code: But the client still cannot read the ETag. The only thing that works is the following: Manually setting the exposed header for each endpoint. Isn’t this wat Cors Mapping was supposed to do…
Tag: spring
Where should I check if username already exist in rest api?
I am creating a rest application using Spring Boot. I’ve got three logical layers: controller, service, and repository. Where should I check if the given username and similar values already exist in the database? In the controller layer, I check user input (length, size, etc.) Can I also check username …
Spring Boot: use database config from WildFly’s standalone.xml
I’m currently developing an REST app whith Spring boot. For development, I hardcode my database configuration in application.properties. However, this app is going to be deployed on different WildFly servers, each of them defining their DB config (user credentials) in standalone.xml. As I’m a newb…
Bad Request from saving structured JSON object
I have created a simple web REST application that has to save a “change ticket” to database. But after I try to create a POST request with JSON as body I get an error: I am using Spring Boot 2, MySQL as DB and MapStruct to convert DTO to entities and vice versa. Also I use Project lombok to get
IBM Data Server licence for JDBC and SQLJ is invalid
Im trying to connect to an IBM DB2 in AS400 using jdbc and ibm DB2 jcc driver. credentials are valid. the problem is, when i try to connect to the client db2, it tells me that my db2 connect licence is invalid. even though i tied to connect with the same driver to another IBM DB2 in a free ibm
Spring data elasticsearch query on multiple indices
I have multiple indices for every day in elasticsearch and I am using ElasticsearchRepository to query my documents. Documents definition: My index will create dynamically for every day with this definition My Repository definition: When I query by client no just returning current day values. Test failed. Cur…
Parsing a request body containing a quoted string as JSON in Spring Boot 2
I have an application which exposes an endpoint accepting PUT requests as a JSON-formatted string, e.g.: My endpoint method signature is something like: Using Spring Boot 1 (1.5.22.RELEASE), the value of myString given the PUT example above would be the literal text some string, but under Spring Boot 2 (2.3.6…
mocking the response for the method called inside the same class
Iam trying to write JUnit test case for the below class scenario. JUnit for the above class. When the above JUnit test case is executed, it is throwing NullPointerException as the details value returned is null. What is the better approach to solve the above error.TIA. –EDIT– In the above code sam…
Can not instantiate value of type […] no single-String constructor
I’m a beginner and I have a boring problem. I’ve been trying to solve this problem for 3 days. Whenever I make a method call, I get this 500 error on the return. I debugged the application in search of the error and realized that it breaks in this method: My ReportEntityDTO Excuse me if informatio…
How to use Class getMethod with lombok @Data
I am trying to call Class getMethod() method with lombok @Data to call getter of model but i got NoSuchMethod exception. Below are my classes: Model class: usage: Exception: Answer You can use below code: for better explaination click here