Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool to generate Spring application context dependency diagram/graph?

Tags:

spring

Is there a tool to generate diagram/graph of Spring application context?

The tool should take into consideration also annotation driven configuration (like @Autowired).

The tool may generate the dependency diagram by 'dumping' BeanDefinitions in runtime. I.e. I don't require the tool to make static code analysis.

like image 268
Michal Vician Avatar asked Mar 14 '12 10:03

Michal Vician


People also ask

What is the use of dependency diagram in spring?

Spring diagrams help you analyze dependencies in your application. You can double-click a bean or a file on a diagram to open it in a dedicated tab in the editor. For Spring Boot, you can also build the Runtime Beans diagram. Spring Beans Dependencies diagram

How do I view dependencies in spring?

Use the Spring Application Context Dependencies diagram to view dependencies between multiple configuration files and analyze how they include and reference each other. Red arrows on the diagram mark errors (such as circular dependencies) to easily spot and remove them from your Spring configuration.

What is a dependency graph in software engineering?

A dependency graph is a graph with directed edges that represent the relationship existing between vertices. Its typical usage consists of describing processes, such as those in the development of software; or relationships, such as those contained in a knowledge graph.

How do I open a spring diagram in Visual Studio Code?

From the context menu, select Diagrams | Show Diagram Ctrl+Alt+Shift+U. This opens the diagram in a separate editor tab. To open it in a popup window, select Diagrams | Show Diagram Popup Ctrl+Alt+U. In the Select Diagram Type popup menu, click Spring Beans Dependencies.


2 Answers

The Spring IDE + Eclipse or the Spring Source Tool Suite can generate simple graphs of your dependencies.

To do that open the view called "Spring Explorer" and choose your project. Then click right mouse -> Properties and combine some/all of your context files into a "Config Set". After saving you can right click on it in the Spring Explorer and choose "Open dependency graph".

The graph is static and quite untidy, but this might help.

like image 85
Stefan Avatar answered Oct 03 '22 22:10

Stefan


IntelliJ IDEA's Ultimate Edition can generate a Spring dependency graph. Basically, right click on the file name and select Diagrams -> Show Diagram. This web page provides the details.

like image 31
kc2001 Avatar answered Oct 04 '22 00:10

kc2001