2016-04-05 72 views
0
Caused by: java.lang.IllegalStateException: Method findByApplicationName can only contain 1 method field. Found: [] 
    at feign.Util.checkState(Util.java:117) ~[feign-core-8.15.1.jar:8.15.1] 
    at org.springframework.cloud.netflix.feign.support.SpringMvcContract.checkOne(SpringMvcContract.java:180) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at org.springframework.cloud.netflix.feign.support.SpringMvcContract.processAnnotationOnMethod(SpringMvcContract.java:143) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at feign.Contract$BaseContract.parseAndValidateMetadata(Contract.java:92) ~[feign-core-8.15.1.jar:8.15.1] 
    at org.springframework.cloud.netflix.feign.support.SpringMvcContract.parseAndValidateMetadata(SpringMvcContract.java:100) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at feign.Contract$BaseContract.parseAndValidatateMetadata(Contract.java:61) ~[feign-core-8.15.1.jar:8.15.1] 
    at feign.ReflectiveFeign$ParseHandlersByName.apply(ReflectiveFeign.java:140) ~[feign-core-8.15.1.jar:8.15.1] 
    at feign.ReflectiveFeign.newInstance(ReflectiveFeign.java:58) ~[feign-core-8.15.1.jar:8.15.1] 
    at feign.Feign$Builder.target(Feign.java:198) ~[feign-core-8.15.1.jar:8.15.1] 
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean$DefaultTargeter.target(FeignClientFactoryBean.java:203) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.loadBalance(FeignClientFactoryBean.java:153) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at org.springframework.cloud.netflix.feign.FeignClientFactoryBean.getObject(FeignClientFactoryBean.java:173) ~[spring-cloud-netflix-core-1.1.0.BUILD-SNAPSHOT.jar:1.1.0.BUILD-SNAPSHOT] 
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168) ~[spring-beans-4.2.5.RELEASE.jar:4.2.5.RELEASE] 
    ... 40 common frames omitted 

如何解決此錯誤?java.lang.IllegalStateException:方法[方法名稱]只能包含1個方法字段。找到:[]

+0

您的源代碼在哪裏?我懷疑任何人都可以用你提供的信息來幫助你。 –

+0

這看起來好像很久以前就放棄了,沒有任何要求澄清的行動。現在投票結束。 – halfer

回答

1

我認爲您的假裝客戶端的方法簽名的@RequestMapping註釋缺少一個方法參數,例如GET或POST - 請參閱下面的代碼示例:

@FeignClient("client") 
public interface MyClient { 
    @RequestMapping(method = RequestMethod.GET, value = "/path-to-endpoint") 
    MyResponse getMyResponse(); 
} 
相關問題