在SpringBoot 2.0 之前,咱們會配置如下類spring
* @date 2018/06/03 */ @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter
可見方法已通過期,SpringBoot 2.0 建議繼承此配置類dom
* @date 2018/06/03 */ @Configuration public class WebMvcConfig extends WebMvcConfigurationSupport {
而後你會發現Controller中沒法注入Pageable了,錯誤提示以下ide
No primary or default constructor found for interface org.springframework.data.domain.Pageable
解決辦法spa
@Override public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { // 註冊Spring data jpa pageable的參數分解器 argumentResolvers.add(new PageableHandlerMethodArgumentResolver()); }