Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging not working for Spring Boot 2.2 and IntelliJ Idea

By running the app in debugging mode (spring-boot:run) with IntelliJ Idea CE, no breakpoints work at all when using Spring Boot 2.2. Instead, when rolling back to Spring Boot 2.1.1, everything works fine. What am I doing wrong? Is there an option/flag to add for 2.2 to make the debugger work?

like image 781
Aaron Falk Avatar asked Nov 06 '19 09:11

Aaron Falk


People also ask

How do I debug a springboot application in IntelliJ IDEA Community Edition?

When debugging a SpringBoot application in IntelliJ Idea Community Edition, additional steps need to be taken. If you have defined your run configuration as spring-boot:run, you will find that the application runs, but does not stop at breakpoints as expected. An easy way to resolve this is to set the spring-boot.run.fork property to false.

What is spring initializr in IntelliJ?

Spring Initializr is a web application that can generate a Spring Boot project. You can select the necessary configuration, including the build tool, language, version of the Spring Boot framework, and any dependencies for your project. IntelliJ IDEA provides the Spring Initializr project wizard that integrates with the Spring Initializr API to ...

How to debug an IntelliJ application in Java?

When running the application in debug mode, the IntelliJ debugger attaches to the Java process that it starts itself (by appending the appropriate parameters, -agentlib:jdwp etc, to the Java command line).

Why can't I debug the Spring Boot Maven plugin?

The release notes indicate that the Spring Boot Maven Plugin now forks the process by default which is the reason why you can't debug the application as you used to with 2.1. If you really have to run the app using the maven plugin, you can disable forking the process (e.g. using -Dspring-boot.run.fork=false)


1 Answers

I would recommend running the app directly from the IDE rather than using mvn spring-boot:run. Doing so will give you the best experience in the IDE.

The release notes indicate that the Spring Boot Maven Plugin now forks the process by default which is the reason why you can't debug the application as you used to with 2.1. If you really have to run the app using the maven plugin, you can disable forking the process (e.g. using -Dspring-boot.run.fork=false)

like image 154
Stephane Nicoll Avatar answered Oct 25 '22 04:10

Stephane Nicoll