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-once semantics to work with Kafka? What is missing in my configuration?
Tag: spring
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, the problem is that in my
How to customize expireAfterWrite for concrete cache if I use cacheBuilder?
Based on this answer I try to use customized expireAfterWrite for “customCache” So my config look like this: Then in codeBase I use: “customCache” And based on my experiments it keeps values on cache pnly 60 seconds by I expect 60 minutes. How to achieve desired result ? Answer I think a better way to do this is as follows.
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 prefix. There was an unexpected
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
Spring WebFlux: Merge Mono and Flux / Put Mono into Flux?
I’m wondering if it is possible to put the value of a Mono as a value into a Flux just like you could append any object to a list. I know there are some methods you could use but none of them fulfills my exact purpose. What I tried so far: This doesn’t sound too bad but notice that it
How to use the same trace id in multiple api calls
I have an api that has several methods. The workflow of the api call is in general like this: login, callX, … and logout. Each api method is doing calls to subsystems. The trace id with sleuth works for e.g. the login call and all it’s subsystems. Now i would like to have a trace id that is the same
What is the recommended way of overriding version of a dependency from parent pom?
I want to override the bouncy castle version from the parent POM. I know we can add the dependency explicitly like so: But this is not the recommended way, the recommended way is adding the version in the properties part of the POM, but I can’t seem to find the name of the version property for Bouncy castle. Answer It
How to store Form data in a H2 Database (currently works using POSTman, but not the website form)
I am just teaching myself the Spring framework and am trying to makie a simple library app which stores user (book) inputs in a form in the H2 Database, and then shows the user the newly inputted data from the H2 Database. Form submission attempt 1: I now have a working POST method which correctly saves a new book to
How to set TotalPages of a PageImpl class in spring boot
I’m converting a Page to a new one by using PageImpl class, but the totalpages attribute has the default value 0. I would like to set totalPages to a specific number. Is it possible to change it? code Answer To get a page as an answer you need to change a line in your code Case 1 To find maximum