在编写Feign Client调用其他微服务的时候出现这个错误:
java.lang.IllegalStateException:
Optional int parameter 'page' is present but cannot be translated into a null value due to being declared as a primitive type. Consider declaring it as object wrapper for the corresponding primitive type.
原因是
@RequestParam(value ="page",required=false) int page
的参数可能不传,为null。但是参数为int类型,不能赋值为null,故需要修改为Integer
@RequestParam(value ="page",required=false) Integer page
网友评论