Skip to content

Spring <beans> XML extraction — connect XML-declared beans to Java classes and to each other (branch ready) #1225

Description

@ESPINS

Legacy Spring / eGovFrame codebases declare beans in XML, so annotation-free classes look dead in the graph today: codegraph emits only a file node per Spring config XML (the MyBatis extractor correctly skips them as non-mapper).

This adds a lenient Spring <beans> extractor: <beans>-rooted XML (comment-aware root sniff; everything else keeps the MyBatis path untouched) emits bean nodes, an instantiates edge to the class= FQN — which is what finally connects a Java class to its XML bean — and bean→bean references (ref/idref/parent/depends-on/factory-bean/p:/c:-ref/method-injection, recursive through collections/inner beans, resolved cross-file by bean name incl. aliases).

Reference implementation on my fork — regex/stack-based like the MyBatis extractor, no new dependency, 56 inline tests:

https://github.com/ESPINS/codegraph/tree/feat/spring-beans-extractor

Validated on the public eGovFrame web sample (Apache-2.0): an annotation-free class (EgovSampleExcepHndlr) now shows its XML bean in the codegraph node trail; 3/3 in-repo instantiates resolved, 16/24 refs resolved (all 8 misses are documented blind spots — annotation-scanned beans etc.); non-Spring XML (pom/web.xml/log4j) unaffected; no node explosion. Documented v1 deferrals in-source: SpEL #{bean} refs, and the mapperLocations → mapper-file promotion that would complete the Spring↔MyBatis bridge.

Independent of #1209 (zero shared files — the branches apply cleanly in any order).

Pick / re-implement whatever's useful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions