这是我写的一个接口,供服务调用
然后写了一个接口调用服务
看起来是没错的,但是当我调用的时候,却报
feign.FeignException$MethodNotAllowed: status 405 reading UserFeignService#findByAccount(String)
仔细一看,405?这不是请求方式不对吗?但是,是get对应这get吖
然后debug一下,发现居然用POST方式来请求!!!
哇…这下子,只能看看怎么搞了
然后查了下网上的资料
在pom引入
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.9</version>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.2.3</version>
</dependency>
然后再看看相关设置,下面的设置默认为true,如果没用过这个设置就不用改了
feign:
httpclient:
enabled: true
好啦,这样就大功告成啦~