When I try to use Paging with FeignClient I get an error.
Error:
Method has too many Body parameters: public abstract org.springframework.http.ResponseEntity com.UserClient.getUserList(com.UserSearchDto,org.springframework.data.domain.Pageable)
Method
@PostMapping("/user/getUserList")
ResponseEntity<Page<UserDto>> getUserList(@RequestBody UserSearchDto searchInputDto, Pageable page);
FeignClientConfig
@Component
public class FeignClientConfigInterceptor implements RequestInterceptor {
@Bean
public Encoder multipartFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(() -> new HttpMessageConverters(new RestTemplate().getMessageConverters())));
}
@Bean
public ErrorDecoder errorDecoder() {
return new RetreiveMessageErrorDecoder();
}
@Bean
public Client feignClient() {
return new ApacheHttpClient();
}
@Bean
public Module pageJacksonModule() {
return new PageJacksonModule();
}
@Bean
public Module sortJacksonModule() {
return new SortJacksonModule();
}
}
I couldn't find where the problem is. How can I fix this problem
Adding @SpringQueryMap to method fixed the error.
import org.springframework.cloud.openfeign.SpringQueryMap;
@PostMapping("/user/getUserList")
ResponseEntity<Page<UserDto>> getUserList(@RequestBody UserSearchDto searchInputDto, @SpringQueryMap Pageable page);