java - How to debug spring-boot application with IntelliJ IDEA community Edition? - Stack Overflow
debugging - Attach IntelliJ IDEA debugger to a running Java process - Stack Overflow
What are non trivial functionalities of IntelliJ IDEA you are using ?
Debugging
If you're building and running locally then it should be easy enough to run your project in debug. Just set some obvious breakpoints and see if it catches after starting with the debug icon. If not then google is your friend.
Intellij likes to do things automagically which can be good and bad. If you set up your project properly then debugging should be trivial.
If you are deploying after building then you may need to set up remote debugging.
Otherwise. Set break points. Step through code. 'Step over' methods is very helpful for code that isn't yours, 'step into' methods if you want to see that method stepped through as well. Set watch variables if needed.
Your question is kind of vague so I hope that helps.
More on reddit.comVideos
EDIT: it does not work anymore from Spring Boot 3+. See Ruik's comment
tldr: You can try tweaking the command line like this:
spring-boot:run -Dspring-boot.run.fork=false
Explanation:
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).
Quite often, these Java processes might then fork a new instance, which is not getting the same parameters, and because it is in a separate process, is not connected to the debugger. This can be confusing.
The spring-boot:run Maven goal, in addition to forking a new JVM, creates even more confusion, because it sometimes does fork and sometimes doesn't, depending on the options it gets, among other things. Some of this can be found in the documentation, but it's not always obvious.
You should first check whether the Java process actually is being debugged at all. When you start the application from IntelliJ, you will see messages scrolling by in the Run / Debug tab. At the top, there's the command line that is being executed. It should contain the debugger parameters (-agentlib:jdwp etc) and it should be followed by a message saying "Connected to the target VM", which is the debugger confirming that it has contact.
Next, if you are unsure if the JVM has been forked, you can check the process list in your OS, for example under MacOS and *nix you can use ps aux | grep java. The Java processes typically have a giant parameter list, most of which is the class path. The actual application being run is at the very end of the command line. If the JVM was forked, you have the process running the Maven goal, and another one running the Spring application. Then your debugger will be connected to the process you are not interested in, and your breakpoints won't work.
To stop spring-boot:run from forking, you can use the fork parameter above.
The only approach that worked for me, is running or debugging application directly from Intellij Idea. Just open class which contains
public static void main(String[] args) {
SpringApplication.run(MyApp.class, args);
}
And click right mouse button->Debug my application
Yes! Here is how you set it up.
Run Configuration
Create a Remote run configuration:
- Run -> Edit Configurations...
- Click the "+" in the upper left
- Select the "Remote" option in the left-most pane
- Choose a name (I named mine "remote-debugging")
- Click "OK" to save:

JVM Options
The configuration above provides three read-only fields. These are options that tell the JVM to open up port 5005 for remote debugging when running your application. Add the appropriate one to the JVM options of the application you are debugging. One way you might do this would be like so:
export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"
But it depends on how your run your application. If you're not sure which of the three applies to you, start with the first and go down the list until you find the one that works.
You can change suspend=n to suspend=y to force your application to wait until you connect with IntelliJ before it starts up. This is helpful if the breakpoint you want to hit occurs on application startup.
Debug
Start your application as you would normally, then in IntelliJ select the new configuration and hit 'Debug'.

IntelliJ will connect to the JVM and initiate remote debugging.
You can now debug the application by adding breakpoints to your code where desired. The output of the application will still appear wherever it did before, but your breakpoints will hit in IntelliJ.
It's possible, but you have to add some JVM flags when you start your application.
You have to add remote debug configuration: Edit configuration -> Remote.
Then you'lll find in displayed dialog window parametrs that you have to add to program execution, like:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
Then when your application is launched you can attach your debugger. If you want your application to wait until debugger is connected just change suspend flag to y (suspend=y)