org.springframework.data.domain.Pageable

This commit is contained in:
GYJ 2024-11-09 11:26:00 +08:00
parent c6aba2caa9
commit 54512eef0c
1 changed files with 9 additions and 0 deletions

View File

@ -4,8 +4,10 @@ import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter; import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.data.web.PageableHandlerMethodArgumentResolver;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter; import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.nio.charset.Charset; import java.nio.charset.Charset;
@ -17,6 +19,7 @@ public class fastJsonConfig extends WebMvcConfigurationSupport {
/** /**
* 使用阿里 fastjson 作为JSON MessageConverter * 使用阿里 fastjson 作为JSON MessageConverter
*
* @param converters * @param converters
*/ */
@Override @Override
@ -45,4 +48,10 @@ public class fastJsonConfig extends WebMvcConfigurationSupport {
converter.setSupportedMediaTypes(mediaTypeList); converter.setSupportedMediaTypes(mediaTypeList);
converters.add(converter); converters.add(converter);
} }
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
// 注册Spring data jpa pageable的参数分解器
argumentResolvers.add(new PageableHandlerMethodArgumentResolver());
}
} }