在SpringBoot2.0及Spring 5.0 WebMvcConfigurerAdapter已被廢棄,目前找到解決方案就有兩種


在SpringBoot2.0及Spring 5.0 WebMvcConfigurerAdapter已被廢棄,目前找到解決方案就有兩種

1 直接實現WebMvcConfigurer (官方推薦)

例如:

@Configuration
public class WebMvcConfg implements WebMvcConfigurer {

//todo

}

2 直接繼承WebMvcConfigurationSupport

例如:

@Configuration
public class WebMvcConfg extends WebMvcConfigurationSupport {

//todo

}

—–2018.04.17—-
今天查了下官方api
Deprecated.
as of 5.0 WebMvcConfigurer has default methods (made possible by a Java 8 baseline) and can be implemented directly without the need for this adapter
An implementation of WebMvcConfigurer with empty methods allowing subclasses to override only the methods they’re interested in.
因此推薦第一種方式
---------------------
作者:cormye
來源:CSDN
原文:https://blog.csdn.net/lenkvin/article/details/79482205
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM