Skip to content

Java/Spring: class-level @RequestMapping prefix dropped from Route nodes — breaks cross-repo-intelligence for prefixed controllers #734

Description

@maehrlae2

Version: v0.8.1 (Windows amd64)

Summary

For Spring MVC/Boot REST controllers that put a base path on the class via @RequestMapping("/prefix") and per-endpoint paths on @GetMapping/@PostMapping/etc., the extracted Route node only stores the method-level path fragment — the class-level prefix is silently dropped. Every Route in the graph ends up with the wrong (truncated) path, so cross-repo-intelligence can never produce a CROSS_HTTP_CALLS edge for these routes: the caller's real URL (which does include the prefix) can never string-match the truncated route.

Repro

@RestController
@RequestMapping("/api/corporate/mcc")
public class MccRequirementController {

    @GetMapping("/corporates/{corporateId}/requirements")
    public ResponseEntity<?> getCorporateRequirements(@PathVariable long corporateId) { ... }
}

Expected Route: GET /api/corporate/mcc/corporates/{corporateId}/requirements
Actual Route in the graph (via search_graph(label="Route", name_pattern=".*mcc.*")): GET /corporates/{corporateId}/requirements — the /api/corporate/mcc prefix is missing.

Not an isolated case: on a real ~45k-node Spring Boot codebase, sampling all 120 extracted Route nodes, none carry their controller's class-level @RequestMapping prefix, across several distinct controllers/base paths.

Impact

index_repository(mode="cross-repo-intelligence") against a real consumer (a Laravel/PHP frontend calling these Java REST endpoints over HTTP with fully-qualified, correct paths) returns total_cross_edges: 0 for every category — consistent with #523, #678, #686, which look like the same underlying bug class (router/class-level prefix stripped) across different frameworks (FastAPI, Go Fiber). This appears to be the Java/Spring instance of that same class of bug, which I didn't see filed separately.

Environment

  • OS: Windows 11
  • codebase-memory-mcp: v0.8.1
  • Language: Java 23 / Spring Boot 3.5.5, @RestController + class-level @RequestMapping + method-level @GetMapping/@PostMapping/etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingparsing/qualityGraph extraction bugs, false positives, missing edgespriority/normalStandard review queue; useful PR with ordinary maintainer urgency.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions