WebMvcConfigurerAdapter已过时

 

 

Spring Boot2.0的版本(创建的时候自动选择的这个版本),然后编译器告诉我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 {
  //省略
}
@Configuration
public class WebMvcConfg extends WebMvcConfigurationSupport {
  //省略
}
推荐使用第一种。直接实现WebMvcConfigurer接口,然后重写方法即可。简便又省事。
原文地址:https://www.cnblogs.com/zpzp6/p/11258743.html