Uploaded image for project: 'Spring IDE'
  1. Spring IDE
  2. IDE-1224

New Spring Template Project for MVC missing annotation on Controller

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 2.8.0.RELEASE
    • Fix Version/s: None
    • Component/s: general
    • Environment:
      OSX 10.7.2

      Description

      When creating a new Spring Template Project with MVC, the generated HomeController is missing the annotation:
      @RequestMapping(value="/")
      on the class definition. When that class-level annotation is not present (the default), I get a 404 for the default context path, even though there is an annotation on the home method:
      @RequestMapping(value = "/", method = RequestMethod.GET)
      public String home(Locale locale, Model model)

        Activity

        Hide
        jbayer James Bayer added a comment -

        Strange behavior - it only seems to happen with the default generated MVC template project. Once I add the annotation to do the mapping and redeploy, it maps the URL correctly (as expected). But it also works if I revert to the original source later (the annotation is not on the class definition).

        Reproducer steps - Create new Spring Template Project - select MVC - Deploy immediately, hit the root context. You should get a warning like this and a 404 response code.
        WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mvc-bar/] in DispatcherServlet with name 'appServlet'

        Show
        jbayer James Bayer added a comment - Strange behavior - it only seems to happen with the default generated MVC template project. Once I add the annotation to do the mapping and redeploy, it maps the URL correctly (as expected). But it also works if I revert to the original source later (the annotation is not on the class definition). Reproducer steps - Create new Spring Template Project - select MVC - Deploy immediately, hit the root context. You should get a warning like this and a 404 response code. WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/mvc-bar/] in DispatcherServlet with name 'appServlet'
        Hide
        mlippert Martin Lippert added a comment -

        This project has moved its issue management to GitHub Issues:
        https://github.com/spring-projects/spring-ide/issues

        Therefore we closed the majority of old issues, like this one here. If you think this issue is still valid and should be fixed or worked on, please feel free to file it as a new issue on GitHub (using the link above).

        Show
        mlippert Martin Lippert added a comment - This project has moved its issue management to GitHub Issues: https://github.com/spring-projects/spring-ide/issues Therefore we closed the majority of old issues, like this one here. If you think this issue is still valid and should be fixed or worked on, please feel free to file it as a new issue on GitHub (using the link above).

          People

          • Assignee:
            Unassigned
            Reporter:
            jbayer James Bayer
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: