Spring Boot2.0的版本(IDEA创建的时候自动选择的这个版本),然后编译器告诉我WebMvcConfigurerAdapter已过时了
WebMvcConfigurerAdapter源码
@Deprecated
public abstract class WebMvcConfigurerAdapter implements WebMvcConfigurer {
/**
* {@inheritDoc}
* <p>This implementation is empty.
*/
@Override
public void configurePathMatch(PathMatchConfigurer configurer) {
}
可以使用以下实现:
@Configuration
public class WebMvcConfg implements WebMvcConfigurer {
//省略
}
推荐 WebMvcConfigurationSupport
@Configuration
public class WebMvcConfg extends WebMvcConfigurationSupport {
//省略
}
本文探讨了在SpringBoot2.0中WebMvcConfigurerAdapter被标记为过时的问题,提供了替代方案,包括使用@WebConfiguration注解的自定义配置类,以及推荐的WebMvcConfigurationSupport继承方式。
3340

被折叠的 条评论
为什么被折叠?



