简体   繁体   中英

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 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM