Skip to content

[validation] detect path in controller annotation param #1582

Closed

Description

@martinlippert
@RestController("/employees")
public class EmployeeController {

might look correct, but it isn't. @Controller annotations take the bean name as the default parameter (as every other stereotype annotation, too), so the code above is correct, but the author might had in mind to add the default path instead of the bean name.

This issue is to add a validation that detects strings args in controller annotations that look like a path and highlight that this might be wrong. As a quick fix, we can offer to add a @RequestMapping annotation to the class with the mentioned path as a parameter (and remove the parameter from the @Controller annotation).

Activity

  1. added this to the Backlog milestone on Jun 16, 2025
  2. added
    for: eclipse
    for: vscode
    on Jun 16, 2025
  3. martinlippert commented on Jun 16, 2025

    @martinlippert
    MemberAuthor
  4. added a commit that references this issue on Sep 15, 2025
  5. martinlippert commented on Sep 15, 2025

    @martinlippert
    MemberAuthor

    Re-opening this one, since the validation is done, but the quick fix is not.

  6. martinlippert commented on Sep 30, 2025

    @martinlippert
    MemberAuthor

    Moved the quick fix part of this out to #1656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

for: eclipsefor: vscodetheme: validationtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions