Rookie new to the big God do not spray, a little Daigo, grateful. Because I always pretend to be humorous, because I want to make myself happy.
- Spring MVC, which is provided by the spring boot, does not meet its own requirements, and it can write a control class plus @EnableWebMvc annotations to control the MVC configuration itself.
- Spring MVC provides a webmvcconfigureadapter that can be customized without the need to use ENABLEWEBMVC annotations when it is necessary to retain and add its own configuration.
1 @Configuration 2 public class webconfig Span style= "COLOR: #0000ff" >extends webmvcconfigureradapter{ 3 @Override 4
public
void
Addviewcontrollers (Viewcontrollerregistry registry) {
5 Registry.addvie Wcontroller ("/xx"). Setviewname ("/xx"
6 } 7 }
The Addviewcontrollers method here does not overwrite the Addviewcontrollers method in Webmvcautoconfiguration, which means that we can use it at the same time.
Little rookie Learn Spring boot--take over the web configuration of Spring boot