I am building a war using maven (mvn clean install), the build is successful but the problem is few spring-boot related jars are getting missed in the war file(I checked using jar tf command) and instead of that many other springboot related classes and layer.idx file is getting added. How to remove these so …
Tag: spring-boot
spring boot REST POST method doesn’t work
I want to get the streamName parameter, which is generated when executing one method in the program where I made HTTPRequest and in response I want to get the generated hex string. I couldn’t find what is missing. This is my code in spring boot: PostResponse class: method on another program where i make…
Spring boot JPA repository passed to another thread not working
I have an autowired jpa repository object working. However, I need to use it to add rows into the database from multiple threads. Though, after passing it to another thread, it fails. Code structure However, doing a dbRepository.save() from a thread safe class, I get error cause: java.lang.IllegalStateExcepti…
Why is my spring boot application launching with java 11 although I created it with java 16?
I started a fresh project from https://start.spring.io/ and chose java 16 as a Framework. This is my build.gradle: I have worked with java 11 and spring boot before so I had Java 11 installed.(I use IntelliJ as my Editor) In order to start my new project, I upgraded my Java version and updated my Path/Java HO…
Spring Boot get JSON Error representation in the ErrorController
Spring Boot provides errors in the json format like this: Is it possible for me to obtain this error inside the ErrorController and to proceed with it? Is it inside the HttpServletResponse or maybe something else? Answer The default error attributes are extracted from a WebRequest using the ErrorAttributes be…
How to setup Kafka Idempotent Producer in Spring Boot?
We would like to store data in Kafka using exactly-once semantics in order to avoid message duplication. Producer with following properties: Kafka topic description: Integration test: Our expectation is that only one message should be stored in Kafka, but the actual result 3 messages. How can I make excatly-o…
Does anyone know why @Valid fails with javax.validation and works with spring starter validation
I have the following controller: which uses this dependency, among others: the LibraryEvent DTO looks like this: And the book inside that library event, is the following: I also have this test which uses MockMvc to send a mocked request to the controller in order to test that one: Everything is fine so far, t…
Spring Boot jsp file not found Error 404 weird prefix
I am currently learning Spring/Spring Boot and I am trying to code a forgot password function. All my other functions, like login etc. are working as intended, but redirecting to an reset-password page does not work for some reason and gives me the following error, in which it looks for the jsp with a weird p…
Bad Request 400 when trying to get all users. Dto and form
I have REST api with User model – DTO and Create / update form. My userService checks if user is administrator, then allow to getAllUsers in List. When I want to get all users, I get Bad request 400, but it should return Forbidden. It used to work but when I added some changes to my code I got bad
Seeding Initial Data – Spring Boot with data.sql
data.sql is executed before JPA entities are created and it creates the error that the table is not found. can anyone help me with it? I have seen the same question in this link Spring Boot – Loading Initial Data but the question is not answered. Answer This is a normal and wanted behaviour from Springb…