After creating the Spring MVC backbone using the XML-based ApplicationContext
, this recipe will highlight the JavaConfig
equivalent of the same baseline project.
Create a web.xml-less
Spring web project using the processes established in the Implementing a Spring container recipe using JavaConfig. Configure appropriately and correctly the pom.xml
file so that the project will no longer use web.xml
. Deploy the blank project first and verify if there are errors before doing this recipe.
Perform the following to build a simple Spring MVC project using the JavaConfig specification:
- Create the
JavaConfig
root context through implementing the abstract classorg.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
. It has the@Configuration
annotation and contains methods that can be overridden to manage validators, view resolvers, controllers, interceptors, and other MVC-specific components needed to...