I'm always excited to take on new projects and collaborate with innovative minds.

Mail

say@bplbmki.in

Website

https://www.bplbmki.in/

tools

 How to debug Spring Boot application with IntelliJ IDEA Community Edition

Problem:

You’re running a Spring Boot app via: mvn spring-boot:run

and your breakpoints are not getting hit in IntelliJ Community Edition.

This happens because spring-boot:run by default forks a separate JVM, and IntelliJ attaches the debugger to the Maven process, not the forked process where your app actually runs.

 

 Solution 1 – Debug the main() class directly

You don’t need the Ultimate Edition for this.

  1. Open the class that contains your Spring Boot main() method, for example: @SpringBootApplication
    public class MyApp {
       public static void main(String[] args) {
           SpringApplication.run(MyApp.class, args);
       }
    }
     

  2. Set breakpoints wherever you need (e.g., in a controller or service method).

  3. Right-click that class → choose Debug 'MyApp.main()'.

  4. Wait for the Spring Boot app to start in Debug mode.

  5. Call your API from Postman or browser — IntelliJ will stop at the breakpoint.

  6. This is the simplest and most reliable approach in IntelliJ IDEA Community Edition.

 

Solution 2 – If you must use mvn spring-boot:run

Modify your command so that it does not fork the process.

Run:

mvn spring-boot:run -Dspring-boot.run.fork=false
 

Now the debugger attaches to the same JVM where your Spring Boot app runs, so breakpoints work correctly.

Alternative (Remote Debugging)

If you still want to run via Maven or java -jar, you can start the app with remote debugging enabled:

mvn spring-boot:run -Dspring-boot.run.jvmArguments="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
 

 

Then in IntelliJ:

  1. Go to Run → Edit Configurations → + → Remote JVM Debug.

  2. Set Host = localhost, Port = 5005.

  3. Start it in Debug mode and trigger your API.

 

 

Optional – Debug via Maven (UI way)

If you prefer to start via Maven goal, you can do it inside the IntelliJ UI too:

  1. Go to Run → Edit Configurations → + → Maven

  2. Name it: Spring Boot (No Fork)

  3. Working directory: path to your pom.xml

  4. Command line:

spring-boot:run -Dspring-boot.run.fork=false