Skip to content

Detect @RequestMapping with path defined as constant instead of literal string #281

Closed

Description

@aaguilera

It seems that Navigation (cmd+6) cannot detect @RequestMapping-annotated methods when the URL is defined as a constant instead of a literal string.
For example:

public class MyPaths {
    public static final String RESOURCE_PATH = "/somepath/resource";
}

@Controller
public class MyController {
    @RequestMapping(MyPaths.RESOURCE_PATH)
    public String method() {
        ... 
    }
}

In STS4, if I press Ctrl+6 (I'm using Eclipse-based STS4 on Linux) and start typing something like "@/some", the results list does not include the mapping for "/somepath/resource".

It would be nice if STS4 implemented such detection.

Activity

  1. added this to the 4.3.0.RELEASE milestone on Apr 29, 2019
  2. martinlippert commented on Apr 30, 2019

    @martinlippert
    Member
  3. spring-projects-issues commented on May 1, 2019

    @spring-projects-issues

    (comment in Pivotal Tracker added by Martin Lippert:)

    Tested this again, works in general, but not for constants defined in the same source file as the request mapping. Will file a separate issue for that.

  4. aaguilera commented on May 2, 2019

    @aaguilera
    Author

    There is a CI build available that includes the implementation for this, if you want to give it an early try and provide feedback: http://dist.springsource.com/snapshot/STS4/nightly-distributions.html

    I have tested spring-tool-suite-4-4.2.2.CI-B1732-e4.12.0-linux.gtk.x86_64.tar.gz and it works perfectly. Kudos to the team for such a quick response!

  5. martinlippert commented on May 3, 2019

    @martinlippert
    Member

    Great to hear that it works for you and thanks for reporting this in the first place. Much appreciated.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions