项目spring-web改为使用spring-webflux时,分页查询时报异常No primary or single public constructor found for interface org.springframework.data.domain.Pageable - and no default constructor found either
解决方案:
自己写一个config类
import org.springframework.context.annotation.Configuration
import org.springframework.data.web.ReactivePageableHandlerMethodArgumentResolver
import org.springframework.web.reactive.config.WebFluxConfigurer
import org.springframework.web.reactive.result.method.annotation.ArgumentResolverConfigurer
/**
* @Author Anson
* @Date 2021/3/12 12:12
* @Version 1.0
*/
@Configuration
class WebConfig : WebFluxConfigurer {
override fun configureArgumentResolvers(configurer: ArgumentResolverConfigurer) {
configurer.addCustomResolver(ReactivePageableHandlerMethodArgumentResolver())
}
}
网友评论