Using annotation-based controller mappings.
@Controller
public class AlertsController {
@RequestMapping(value="create", method=RequestMethod.GET)
public void create(HttpServletRequest request, Model model) {
}
}
When access alerts/create, I get the message Does your handler implement a supported interface like Controller?. This seems odd, and counter to what the documentation says.
So, I add in a RequestMapping to the class:
@Controller
@RequestMapping("/alerts")
public class AlertsController {
@RequestMapping(value="create", method=RequestMethod.GET)
public void create(HttpServletRequest request, Model model) {
}
}
This, then, works. I shouldn't need either @RequestMapping, but I do. Now, things get weird. I really wanted to map this to `/profile/alerts', so I change it to this:
@Controller
@RequestMapping("/profile/alerts")
public class AlertsController {
@RequestMapping(value="create", method=RequestMethod.GET)
public void create(HttpServletRequest request, Model model) {
}
}
I get a 404 when going to profile/alerts/create, but it's still mapped to /alerts/create for some reason?!?!?!
I change it to:
@Controller
@RequestMapping("foobar")
public class AlertsController {
@RequestMapping(value="create", method=RequestMethod.GET)
public void create(HttpServletRequest request, Model model) {
}
}
This is very strange and incredibly inconvenient. Anyone have a way to fix this, or even debug what is going on?