Spring Call Graph
Visualize method call graphs for Spring Boot Java projects — directly inside VS Code.
Spring Call Graph scans your workspace's Java source files, resolves Spring dependency injection, and renders an interactive, clickable call-flow diagram starting from any method you choose.
Features
Interactive Call Graph Visualization
Point at any method in your Spring Boot project and instantly see the full execution path — controllers, services, repositories, and beyond.
- Mermaid-based diagram rendered in a dedicated panel
- Clickable nodes — click any node to jump straight to that method in the source file
- Depth slider — adjust traversal depth on the fly without re-running the analysis
- Export the diagram as PNG or JPEG
Two Ways to Trigger Analysis
1. From the Command Palette
Open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run:
Spring: Analyze Method Call Graph
Enter the entry point in the format ClassName#methodName, e.g.:
UserController#createUser
2. Right-click in a Java file
Right-click anywhere inside a method body and choose:
Spring: Show Call Graph from Cursor
The extension automatically detects the enclosing class and method name.
Spring-Aware Analysis
The extension understands Spring's annotation model and enriches every node with contextual metadata:
| Annotation |
Recognized as |
@RestController, @Controller |
Controller layer |
@Service, @Transactional |
Service layer |
@Repository |
Repository / DAO layer |
@Component, @Configuration |
Generic component |
@GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PatchMapping |
REST endpoint (method + path shown on node) |
@Transactional |
Transactional boundary marker |
@Async |
Async execution marker |
@Cacheable |
Cache marker |
@Autowired, @Inject, @Resource |
Dependency injection edge |
Configurable Options
Open Settings (Ctrl+,) and search for Spring Call Graph:
| Setting |
Default |
Description |
springCallGraph.maxDepth |
5 |
Maximum traversal depth (1–20) |
springCallGraph.excludePackages |
java., org.springframework., … |
Package prefixes excluded from the graph |
springCallGraph.collapseLibraryCalls |
true |
Collapse external library calls into a single node |
springCallGraph.includeObjectCreations |
true |
Include new ClassName() as graph edges |
Getting Started
- Open a Spring Boot Java project in VS Code.
- Open any Java controller or service file.
- Right-click inside a method → Spring: Show Call Graph from Cursor.
- The call graph panel opens on the side.
- Use the depth slider to expand or collapse the graph.
- Click any node to navigate to that method.
Requirements
- VS Code 1.85.0 or newer
- A workspace containing
.java source files (no compilation required — analysis is purely source-based)
Extension Settings
{
// Maximum call graph traversal depth
"springCallGraph.maxDepth": 5,
// Packages to exclude from the graph
"springCallGraph.excludePackages": [
"java.",
"javax.",
"org.springframework.",
"org.slf4j.",
"com.fasterxml.",
"org.apache.",
"io.micrometer."
],
// Collapse calls into external library methods
"springCallGraph.collapseLibraryCalls": true,
// Include object creation (new Foo()) as edges
"springCallGraph.includeObjectCreations": true
}
Known Limitations
- Dynamic dispatch / AOP proxies: Runtime proxy behavior (e.g.
@Transactional wrapping) is not simulated. The annotation is shown as metadata on the node instead.
- Multiple interface implementations: When a field's type is an interface with multiple implementations, the extension picks the best candidate based on
@Primary or @Qualifier annotations. If ambiguity remains, it is flagged on the node.
- No bytecode analysis: Analysis is purely source-based (AST). Methods from pre-compiled dependencies will not be traversed.
- Lambda / method-reference edges: Complex lambda call chains may not be fully resolved.
Release Notes
0.1.0 — Initial Release
- Source-level Java AST parsing
- Spring annotation recognition (controllers, services, repositories, components)
- REST endpoint detection from mapping annotations
- Interactive Mermaid call graph panel
- Clickable node → navigate to source
- Adjustable traversal depth slider
- Export diagram as PNG / JPEG
- Configurable package exclusions and traversal limits
Contributing
Issues and pull requests are welcome. Please open a GitHub issue to discuss significant changes before submitting a PR.
License
MIT