I have a spring-boot application,my client like this
@FeignClient(name = "app1")
public interface App1Client {
@GetMapping(value = "/api/foos",produces = MediaType.APPLICATION_JSON_VALUE)
List<FooDTO> getAllFoos();
}
and use
@Inject
private App1Client app1Client;
and run it throw exception
Caused by: java.lang.IllegalStateException: Method userMessageCode not annotated with HTTP method type (ex. GET, POST)
at feign.Util.checkState(Util.java:128)
at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:97)
at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:131)
at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:64)
at feign.hystrix.HystrixDelegatingContract.parseAndValidatateMetadata(HystrixDelegatingContract.java:33)
at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:146)
at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:53)
at feign.hystrix.HystrixFeign$Builder.target(HystrixFeign.java:48)
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean$HystrixTargeter.target(FeignClientFactoryBean.java:251)
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:156)
at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:177)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 32 common frames omitted
my spring-boot version is 1.4.2.RELEASE and com.netflix.feign.feign version is 8.16.2
Comment From: Koizumi85
Yes, you have to use the old @RequestMapping annotations with a specified method value. There is another Issue for supporting them already: #1401
Comment From: anjia0532
OK ,thank you~
Comment From: huangying123456
I used RequestMapping but still failed
Comment From: clove506
I used RequestMapping but still failed
ooooops~~~would you find solution
Comment From: bandanag1
I am still getting error for @GetMapping. Anyone with further clue?
Comment From: ferchitas
any update?