I'm relatively new to Spring and I'm a little confused about the tag.
After going through the documentation and looking around different posts it seems like the main use of is that it is required by Spring MVC to dispatch requests to @Controllers.
I created a controller with two requestMappings:
@RequestMapping(method=RequestMethod.GET, value="/health") @RequestMapping(method=RequestMethod.GET, value="/test")
I tested the web app with and without in the servlet.xml and it doesn't seem like any difference was made with being omitted or not. The requests seemed to still reach my controller just fine.
Can anyone explain to me what exactly that tag is used for?
Thanks in advance!
The support for
@Controller
and@RequestMapping
is provided by Spring by default. However, by enablingmvc:annotation-driven
you get support for processing the requests that are mapped to annotated controller methods, such as declarative validation, formatting and conversion service. An excerpt from spring's blog that introduced the new config featuresAnother related usefull blog post
Finally a more formal definition in the official docs