New answers tagged spring-boot
Best practices
0 votes
0 replies
0 views
Understanding using Spring Boot in IntellIJ with layered architecture
Documentation (Spring has a lot of documentation), tutorials, books (for some types of things), blogs, etc. LLMs may help, but without certain levels of actual knowledge, it’s just a bandaid, and you’...
Best practices
1 vote
0 replies
0 views
Understanding using Spring Boot in IntellIJ with layered architecture
Can you please give some more details what files, what kind of project setup you have? Are you interested in contents of files in a project that you open in IntelliJ or do you want to analyse the IDE ...
Best practices
0 votes
0 replies
0 views
In springboot projects, how to implement front-end preview of pdf, word, excel
First of all, thank you for your reply and sorry that it took me so long to notice your answer, being busy with other projects lately. You're right, I was actually looking for a solution, and Stack ...
1 vote
How to correctly map nested OpenID Connect (OIDC) claims to Spring Security 6 Authorities?
I'm configuring the SecurityFilterChain like the following in one of my projects: @Bean public SecurityFilterChain securityFilterChain( final HttpSecurity http, final ...
Advice
0 votes
0 replies
0 views
How to get industry ready as a Spring Boot developer?
The only way you can decide on a route to follow, is to look at the job requirements in your local area. It is not likely that any company will employ you as a fressher if you are not in the local ...
Best practices
0 votes
0 replies
0 views
How to customize ObjectMapper in Spring Boot 4 without losing existing settings?
If you stick with Jackson 2 (preferred to upgrade to Jackson 3 as that is the default in Spring Boot 4). You will need a Jackson2ObjectMapperBuilderCustomizer which will allow you to modify the ...
Best practices
0 votes
0 replies
0 views
How to customize ObjectMapper in Spring Boot 4 without losing existing settings?
It exists since Jackson 3. Since you are using Spring Boot 4 you should also use Jackson 3. Here's a reference to the method: rebuild(). It returns a MapperBuilder. If you're still using Jackson 2 ...
Best practices
0 votes
0 replies
0 views
How to customize ObjectMapper in Spring Boot 4 without losing existing settings?
Sorry, mistakenly upvoted, but there is no way change it now. My question is, is there a rebuild() method exists in ObjectMapper ?
Best practices
2 votes
0 replies
0 views
How to customize ObjectMapper in Spring Boot 4 without losing existing settings?
You can try to inject ObjectMapper, which should be the default one, then call rebuild() to get a new builder with the settings of the existing object, make your changes to the builder, then call ...
0 votes
Accepted
How to define ObjectMapper based on autoconfiguration?
I found a solution by reading this migration guide. To be able to modify the default ObjectMapper you need to create a bean of this type @Bean public JsonMapperBuilderCustomizer jacksonCustomizer() { ...
0 votes
Dynamic route for LoginPage in security configuration
This may work for your case: Use a custom LoginUrlAuthenticationEntryPoint instance: public class LocaleLoginUrlAuthenticationEntryPoint extends LoginUrlAuthenticationEntryPoint { private final ...
0 votes
How to define ObjectMapper based on autoconfiguration?
In Spring Boot 4, don’t create a new ObjectMapper bean if you just want to add some settings. If you do that, you will override the default one and lose configurations from application.yml or ...
1 vote
Accepted
Unable to retrieve the correct message in @GlobalHandler
The reason you are seeing /error as the path and a generic message is that by the time your AuthenticationEntryPoint hands the exception to the HandlerExceptionResolver, the request has already been &...
Tooling
0 votes
0 replies
0 views
SpringBoot & Docker desktop & IntelliJ Idea
I did not need to find that ...osxkeychain. Just give access to everyone. Thanks for help.
Tooling
0 votes
0 replies
0 views
SpringBoot & Docker desktop & IntelliJ Idea
How to delete comment? Where can I find ""docker-credential-osxkychain" ?
Tooling
0 votes
0 replies
0 views
Tooling
2 votes
0 replies
0 views
SpringBoot & Docker desktop & IntelliJ Idea
Here’s what to do: When prompted, enter your Mac login password (the same one you use to unlock your computer). Click Always Allow so Docker can access your credentials automatically in the future. ...
Best practices
0 votes
0 replies
0 views
Spring boot redis queue
I think it is just a standard stackoverflow question rather then best practices. Anyway could provide some code?
0 votes
Hibernate Cache causing OOM. Cache not showing (deleted) entities that are cached
The piece that is missing is this: Without @Transactional, every call to deleteAllById() runs inside its own short‑lived Hibernate session. So without a long‑running transaction, Hibernate’s ...
0 votes
class java.lang.String cannot be cast to class org.keycloak.KeycloakPrincipal
I would double, and even triple check that the object is not null. You may see in your code that you are indeed setting a SecurityContext with an Authentication that has a Principal with your specific ...
0 votes
Spring Boot 4.0.0 + GCP : java.lang.NoSuchMethodError: org.springframework.boot.context.config.ConfigDataLocationResolverContext.getBootstrapContext()
This works with Spring Boot 4.0.3: <dependencyManagement> <dependencies> <dependency> <groupId>com.google.cloud</groupId> <...
Tooling
0 votes
0 replies
0 views
Spring gRPC and Spring Boot compatibility
No, it's not backwards compatible. A lot of it will work, but not everything. You should use Spring Boot 4 with it.
Advice
0 votes
0 replies
0 views
Is spring boot going to be outdated and its developers will going to be laid off?
Understood Magnus and Thank you for your thoughts , as you have 25 years of experience in Java so , can you guide me a little bit , i have made 2 projects in Spring boot , one purely backend using ...
2 votes
How to connect GridDB Cloud to a Java Spring Boot application?
Dependency Management Add the GridDB Java Client to your pom.xml. If you want Spring-like abstractions, use the official GridDB Spring Data support, but the raw Java client is often preferred for ...
0 votes
Spring Boot graphQl autoconfiguration fails to instantiate graphQlSource at app startup
Ran into the same problem today. Found out that the fields in my class were private and graphql requires public fields to be mapped to its schema.
0 votes
Caffeine cache with spring boot not working
If your bean calls its own method directly, you bypass the Spring proxy, so Caching won’t work. public class Service { this.method() // like this method() // or like this @Cacheable or @CacheEvict ...
2 votes
VectorStore.accept() exhausts HikariCP connection pool when batch ingesting with virtual threads
The core issue is that virtual threads remove the natural backpressure that platform threads provide. With a FixedThreadPool(10), you'd never have more than 10 concurrent accept() calls. With virtual ...
1 vote
Hibernate LEFT JOIN FETCH returns empty PersistentBag in Spring @Transactional integration test
The "empty PersistentBag" issue in a @Transactional context might be caused by Persistence Context Pollution (First-Level Cache). Let's try to force Hibernate to "forget" the ...
0 votes
I can't make relationships on spring boot
As you have told in the comments that you are getting output like: category: { id: 1, title: "test", products: [] } The reason for this is line: @OneToMany(mappedBy = "...
0 votes
Sending data to Thymeleaf (HTML) from Spring-Boot MVC (Java), Not being displayed
If your goal is to display the name inside the header and keep a custom data attribute for JavaScript or CSS, do this: <h3 data-th-test="${name}" th:text="'Employee List for ' + ${...
0 votes
Spring Boot 4 / Spring Security 6 – @WithMockUser returns 401 Unauthorized in MockMvc test
With Spring Boot 4 you need to change the dependency since mostly you need a starter dependency. Change testImplementation 'org.springframework.security:spring-security-test' with testImplementation '...
1 vote
Accepted
Error wihile runnging Test: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call
Solution To fix this issue, you need to add @Transactional to the method in either the Controller or the Service layer (the Service layer is preferred). In this test, you are calling the /api/auth/...
1 vote
HttpStatus code in case of update operation but no row gets updated
There is no special HTTP status code for "no changes applied", but you can send the same 200 OK status if the update did not affect any rows, because the end result in the database is the ...
Best practices
0 votes
0 replies
0 views
In springboot projects, how to implement front-end preview of pdf, word, excel
First, the complexity of this challenge is cannot be answered by just few lines of code, you are essentially asking for a solution + vendor choice. So maybe this question is not even belong to SO. ...
0 votes
java.lang.UnsatisfiedLinkError: The specified procedure could not be found when trying to use thick (Oracle Instant Client) JDBC connection
As one of the earlier comments noted, the issue is not with locating the ocijdbc23.dll file, but calling the corresponding method within the ocijdbc23.dll file. What function or method are you trying ...
0 votes
Accepted
Spring Boot 4 embedded Tomcat (11.0.15) unable to reference nested enum classes
This is not a Spring Boot or Tomcat bug but an issue of classpath flattening in embedded containers (vs traditional standalone WAR deployment). When mixing container implementations and API jars on ...
Best practices
1 vote
0 replies
0 views
How to think the organisation of a Java Spring-Boot multi-module project in a clean architecture? I'd like to redispatch/reforge an hexagonal one
[So] is about programming. For questions about design try https://softwareengineering.stackexchange.com/.
0 votes
Jackson deserialize GeoJson Point in Spring Boot
If you come to this in 2026 looking for answers for the Spring Boot 4 + Migrating to Jackson 3 case, maybe this Jackson Config will help. My advice is to use the n52 jts module, as it's still ...
0 votes
GoogleJib is stuck at 80 percent while creating docker image
Happened to me as well, when calling jib:dockerBuild maven target (loads an image into local docker registry). Probably, after update of local Docker Desktop on Windows 10 to 4.58.0. Updating jib ...
0 votes
Optimizing Exact Filtered Pagination Count (COUNT(*)) on MySQL with Dynamic JSON Filters in Spring Boot API
Since you need to get at various parts of the JSON, you should make columns for those parts in the table. Extract them when receiving the data. Also, do cononical transformations as desired (remove ...
2 votes
MDC and SecurityContext propagation failing when using Virtual Threads (Executor)
Native MDC and Spring Security solution is @Bean public ExecutorService virtualThreadExecutor() { return Executors.newThreadPerTaskExecutor(r -> { final Map<String, ...
0 votes
Spring Boot + Auth0: Health endpoint returns 401 on Azure App Service but works locally even though path is excluded from SecurityFilterChain
when looking in the response from your curl call we can see the following: WWW-Authenticate: Bearer resource_metadata="https://example.westeurope-01.azurewebsites.net/.well-known/oauth-protected-...
0 votes
Spring WebFlux + Spring AI + OpenRouter: "block()/blockFirst()/blockLast() are blocking" error in coroutine
You can use the streaming API exposed by SpringAI that usually returns a Flux which you can align it with your coroutines without any blocking. Sample Controller for SSE: @GetMapping("/chat",...
0 votes
Spring Boot ConfigurationPropertiesBinding for ImmutableMap
Spring Boot's Environment flattens map properties (e.g., test.map-property.foo=1). Because there is no single "Map" object in the source environment to pass to your Converter, Spring Boot ...
4 votes
MDC and SecurityContext propagation failing when using Virtual Threads (Executor)
Have you tried using Micrometer Context Propagation and wrap the executor with ContextExecutorService so MDC and SecurityContext ThreadLocals are captured and restored automatically. import io....
0 votes
Springb Boot 4.x Testing: import of TestRestTemplate cannot be resolved, JUnit 6, Gradle, Intellij
As confirmed in a previous post. The official migration guide states the following: 'In the event of a compilation failure in your tests for TestRestTemplate, add a test-scoped dependency on org....
3 votes
Error with symbol not found: "Method onConstructor_()"
Your Lombok version doesn't support onConstructor_. The trailing underscore syntax was introduced in Lombok 1.18.4. Below that, the parameter is onConstructor (no underscore), and it uses a different ...
Tooling
1 vote
0 replies
0 views
Spring boot structured logging issue
Extend EcsStructuredLogFormatter directly This is the correct fix. Override the service-writing logic to include service.id: public class CustomEcsFormatter extends EcsStructuredLogFormatter { ...
0 votes
Spring AI support of enumNames
For tool/function inputs Spring AI generates only standard JSON schema. You can try using oneOf in combination with const and title instead of the usual enum pattern. "myEnum": { "...
0 votes
Spring AI and Spring Cloud Compatibility Issue: JSON Parsing Error in OpenAI Chat Client
You can try below workarounds as well. 1.Combining Spring Cloud 4.2.x with Spring AI M6 may cause HTTP client conflicts. If you are allowed to upgrade the Spring AI version, then changing to 1.0.0 ...
Top 50 recent answers are included
Related Tags
spring-boot × 150480java × 78544
spring × 55073
spring-data-jpa × 10710
hibernate × 10208
spring-mvc × 10138
spring-security × 9634
jpa × 7545
maven × 6787
rest × 4940
thymeleaf × 4118
spring-data × 3487
mysql × 3452
docker × 3368
mongodb × 3012
gradle × 2769
postgresql × 2722
tomcat × 2649
kotlin × 2645
json × 2530
spring-webflux × 2508
spring-cloud × 2408
junit × 2384
angular × 2338
spring-batch × 2026