I'm trying to figure out if there's a tool that can statically analyze my Spring project to create a call graph or a dependency tree, starting from my controller methods. My goal is to understand the internal workings of each endpoint and visualize the class hierarchy involved. I attempted to use Spring Actuator, but since I can't run the application, that doesn't work for me. It needs to function statically and ideally should be compatible with VSCode or usable from the command line. Any suggestions would be greatly appreciated!
6 Answers
You might want to check out a profiler like YourKit. It can be useful for analyzing performance and might give you the insights you're looking for.
I’d love to see a visual representation of my app too! It could definitely help in breaking down a monolith based on database tables and understanding the structure better.
IntelliJ can do this really well! Just click on the method name and press Ctrl + Alt + H, and it'll show you the call graph. It works for any Java codebase and even allows you to navigate in both directions, which is pretty sweet.
It would be awesome if they added an option to export the graph!
I think Digma could provide the analysis you need. Give it a try!
If you have tests that run your endpoints, consider using VisualVM to profile your application during those tests. Also, IntelliJ has a flow analysis feature that might help you track data flow more effectively.
If you're using an IDE, it should work fine for a monolithic application. But for microservices, it's likely that the IDE won't be able to manage the complexity as effectively.
What do you mean by that? How does being part of a microservice architecture change the IDE's capabilities?
Is that call graph feature a plugin or built-in?