微服务采用Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method search not annotated with HTTP

用Feign调用远程服务时,出现以下异常:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '**Controller': Unsatisfied dependency expressed through field '**Feign'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.****': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Method search not annotated with HTTP method type (ex. GET, POST)

Caused by: java.lang.IllegalStateException: Method search not annotated with HTTP method type (ex. GET, POST)

仔细检查后发现,是在feign接口中对应的方法中忘记添加对应的HTTP注解。

微服务采用Feign调用远程服务报错:Caused by: java.lang.IllegalStateException: Method search not annotated with HTTP

加上以后便能正常启动。