WebMvcConfigurerAdapter已过时的替代方法

1、WebMvcConfigurationSupport替换
但此方式原有的MVC自动配置会失效,很多静态资源无法访问。需要自已写配置。

2、使用WebMvcConfigurer接口
实现其中的addViewControllers方法
registry.addViewController("/").setViewName(“login”);
registry.addViewController("/index.html").setViewName(“login”);

不要忘记在类前面增加@Configuration

猜你喜欢

转载自blog.csdn.net/weixin_40404189/article/details/88796901