Debugging spring dependency in IntelliJ

I’m creating a module for a Spring application. The way it works is that the main application includes modules and when it runs it picks up on its Spring annotations. So it ends up being two different projects on two different windows in IntelliJ.

So to run my module, I have to mvn install it in the local repository and then it run the application which includes it in the <dependencies>.

I have both projects open in IntelliJ. I set a breakpoint in the module, run the main application, and call the endpoint defined in the module. It doesn’t stop, which I expected. Is there a way to do something equivalent to debug my module? I need the outside application because of the database and configurations, so I can’t run the module directly.


Let’s suppose there are 2 modules A and B where B module is added as dependency in module A. If you want to debug the code flow from A to B, instead of putting breakpoint in B project (imported in IntelliJ) you have to put breakpoint in module A only.

You can find dependency in External Libraries

You must be aware of package of the class in module B, so you can navigate to that class from external libraries and put breakpoint on required method of class in module B.

Open the depedency class of project B inside A and attach the breakpoints.

Run application A with debug mode on, your depedency in B project will get hit eventually.

Leave a Reply

Your email address will not be published. Required fields are marked *