Skip to content

fix(java): add Spring DI instantiates edges for @Autowired and @Requi…#854

Open
Liurchen wants to merge 1 commit into
colbymchenry:mainfrom
Liurchen:fix/spring-di-instantiates
Open

fix(java): add Spring DI instantiates edges for @Autowired and @Requi…#854
Liurchen wants to merge 1 commit into
colbymchenry:mainfrom
Liurchen:fix/spring-di-instantiates

Conversation

@Liurchen

Copy link
Copy Markdown

…redArgsConstructor

Detect two Spring dependency injection patterns and emit instantiates edges so the graph models the Controller→Service→Repository wiring:

  1. @Autowired fields — direct field injection
  2. @requiredargsconstructor classes — Lombok constructor injection, detected by finding private final fields inside annotated classes

The enclosing-class lookup adjusts the line number to match tree-sitter's class_declaration start position (annotation line, not class keyword line), so the fromNodeId correctly resolves to the existing class node.

Verified on realworld-java21-springboot3: +31 instantiates edges covering all Controllers→Services→Repositories chains.

…redargsconstructor

Detect two Spring dependency injection patterns and emit `instantiates`
edges so the graph models the Controller→Service→Repository wiring:

1. @Autowired fields — direct field injection
2. @requiredargsconstructor classes — Lombok constructor injection,
   detected by finding `private final` fields inside annotated classes

The enclosing-class lookup adjusts the line number to match tree-sitter's
class_declaration start position (annotation line, not `class` keyword
line), so the `fromNodeId` correctly resolves to the existing class node.

Verified on realworld-java21-springboot3: +31 instantiates edges covering
all Controllers→Services→Repositories chains.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant