Spring IDE
  1. Spring IDE
  2. IDE-1224

New Spring Template Project for MVC missing annotation on Controller

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • 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
        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
        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'

          People

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

            Dates

            • Created:
              Updated: