I want to use the HTTPSessionIdResolver for everything located under “/api**” and for everything else the standard CookieResolver. How is this possible, so that the two configurations use different resolvers? With my current approach everything uses X-AUTH. I tried to understand the implementation within Spring and I end up in the SessionRepositoryFilter, but of this filter only one instance is
Tag: spring
JSON parse error: Cannot deserialize value of type `java.time.LocalDateTime` from String
I am sending request to external service which has updatedDate property When I receive the response in my DTO I am trying to format the LocalDateTime property like this But I get error in Postman Answer There are milliseconds in the input string, so your format should be “yyyy-MM-dd’T’HH:mm:ss.SSS” Update: If the millisecond part consists of 1, 2, 3 digits
Cannot pass JWT refresh token as an argument
I’m trying to get a new access token using a refresh token in Spring Boot with OAuth2. It should be done as following: POST: url/oauth/token?grant_type=refresh_token&refresh_token=…. It works fine if I’m using InMemoryTokenStore because the token is tiny and contains only digits/letters but right now I’m using a JWT token and as you probably know it has 3 different parts which
Spring JPA ManyToMany with additional table persists with null id
I have these entities: My HeroService is like this: I am using postman to create a new Hero and this is a sample POST request: Although a hero is created and two entities on HeroSkill table are also created, the HeroSkill hero_id column is null, so my new heroes are not associated with their skills as they should be. It
Spring Retry – Exception problem and retries
How can we catch two different exceptions (ex. from .lang and .io packages) in the same block of @Retryable method. One, we return an IOException and the other we retry the method. Answer You can use the include parameter of the annotation to handle multiple various exceptions:
Why is the shutdown endpoint not enabled in my application?
I am trying to add a shutdown endpoint actuator/shutdown in my Spring application as explained in this tutorial so that I can gracefully shutdown the application using a call like curl -X POST localhost:8080/actuator/shutdown. I added to my pom.xml and to src/main/resources/application.yaml. But when I run curl -X POST localhost:8080/actuator/shutdown, I get the following response: I don’t see the shutdown
How to disable the Hypersistence banner when using hibernate-types-52 in Spring Boot?
I use the com.vladmihalcea:hibernate-types-52 dependency in my Spring Boot Project. And, I notice that on application boot, some large log messages were added: The hint is nice and the project sounds actually interesting, but still want to have the banner removed from my application. Answer There is a description by the Project Owner why the banner was introduced, why it
No mapping for static-resources Spring Boot
In my Spring-Boot application, js and css files do not work, it says 404 not found. My html-page includes the following: I configured resources so: But in logs I receive: This is the location of static-sources: What am I doing wrong? Answer By default, this handler serves static content from any of /static, /public, /resources, and /META-INF/resources directories that are
Adding Same Site Header to JSESSIONID Spring Security
Google chrome has introduced changes that require setting the Same-Site header. In order to achieve this, I added a custom filter as follows, Following is the code for Security Configuration However, when I look at the headers received, I get this The filter adds the required fields in all the responses exception the one containing the JSESSIONID cookie. How do
Unable to set Command Line profile in spring boot 2.2
Unable to run spring boot maven project with spring-profiles. I’ve tried the following commands which all return the same error mvn spring-boot:run -Dspring-boot.run.profiles=local mvn spring-boot:run -Dspring.profiles.active=local mvn spring-boot:run -Dspring-boot.profiles.active=local I’m using SpringBoot 2.2.5 and Maven 3.6.3 on Java 11 Edit: Adding Full Debug Logging from suggested command mvn spring-boot:run -Drun.jvmArguments=”-Dspring.profiles.active=local” -X I am getting practically the same logs with every