I have a small job written with Spring Boot Batch 2.2.2. It takes a date as a parameter, and since several components need that date, I place it as a bean in the Spring context : It works well, no issue. Now I am doing some refactoring, and thought I should use LocalDate instead of Date, as it is now
Tag: spring-boot
Composite annotations to reuse
we have couple of annotations, for springboot controller method. and these are mostly reused in multiple methods. combine as Is there a way we can create a composite annotation ? I know we might as well add a new one which encapsulates these, but at times this is not possible. Just trying to reuse these bunch as single or reduced
WebMvcConfigurer addCorsMappings exposed headers doesn’t work
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? ExposedHeaders simply don’t work
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 newbe to Spring/Java, here is my question: How can I use the DB config from standalone
Axon: Create and Save another Aggregate in Saga after creation of an Aggregate
Update: The issue seems to be the id that I’m using twice, or in other words, the id from the product entity that I want to use for the productinventory entity. As soon as I generate a new id for the productinventory entity, it seems to work fine. But I want to have the same id for both, since they’re
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. Current day values returned not searched all indices. Probably Spring data searching a
How to insert a fragment from another template
Web project in java using thymeleaf. I want to insert in a file: Here is this fragment: As a result, I get the error: “Whitelabel Error Page”. What am I doing wrong? Answer It turned out when I wrote like this:
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.RELEASE), it’s now the literal text “some string” – i.e. it