spring boot 2.0 提示 No primary or default constructor found for interface Pageable 解决办法
作者:互联网
在SpringBoot 2.0 以前,我们会配置以下类
@Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter
可见方法已经过期,SpringBoot 2.0 建议继承此配置类
@Configuration public class WebMvcConfig extends WebMvcConfigurationSupport {
然后你会发现Controller中无法注入Pageable了,错误提示如下
No primary or default constructor found for interface org.springframework.data.domain.Pageable
@Override public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) { // 注册Spring data jpa pageable的参数分解器 argumentResolvers.add(new PageableHandlerMethodArgumentResolver()); }
标签:Pageable,No,spring,primary,interface,2.0,public 来源: https://www.cnblogs.com/matd/p/11498883.html