1、在实际开发过程中,仅仅是SpringBoot集成的功能使用SpringMVC是仅仅不够的,比如: <mvc:view-controller path=/success view-name=success/> <mvc:default-servlet-handler/> <mvc:annotation-driven></mvc:annotation-driven>

3、使用WebMvcConfigurerAdapter可以来扩展SpringMVC的功能,比如浏览器发送/bg请求来到success视图。代码中的双引号已经被删除,请自行加上package com.gwolf.config;import org.springframework.context.annotation.Configuration;import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;@Configurationpublic class MyMvcConfig extends WebMvcConfigurerAdapter{ @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController(/bg).setViewName(success); }}

5、EnableWebMvcConfiguration会加载容器中所有的WebMvcConfigurer一起起作用。这样SpringMVC的自动配置和我们的配置类也会被调用。

