Since the migration to Spring Boot 3 my application doesn't hold at breakpoints any more, when I run the Maven Spring Boot goal mvn spring-boot:run
.
This is because Spring forks the thread or the process and the debugger is not attached to this.
In former Spring-Boot versions you could disable forking by passing -Dspring-boot.run.fork=false
(see How to debug spring-boot application with IntelliJ IDEA community Edition?).
Unfortunatly this option was removed as you can read in the Spring Boot 3.0 Migration Guide:
The fork attribute of spring-boot:run and spring-boot:start that was deprecated in Spring Boot 2.7 has been removed.
Is there any possibility to make breakpoints work again?
Ideas so far
Of course IntelliJ Ultimate has better Spring Boot integration. I'm trying to make it work with the Community Edition.
I also tried not to run the Maven goal but to make an Application run configuration. This failed so far, because of
java.lang.ClassNotFoundException
, it doesn't find the Main class. Not sure if I should investigate that option further.Last idea was to start the Maven goal with debug options such that an external debugger can attach. That didn't work either and even if it would, I could only attach the debuger after startup and that would make debugging the creation of spring context impossible.