2017-06-20 143 views
0

在我的项目中,diffrent服务作为微服务进行部署,授权和身份验证在通用的jar文件中处理,该文件作为每个微服务项目中的依赖项添加。Feign客户端无法加载服务

微服务之间的通信是通过假死客户做

摇篮文件为这样的服务如下

dependencies { 
    compile('org.springframework.boot:spring-boot-starter') 
    compile('org.springframework.cloud:spring-cloud-starter-eureka'){ 
    compile('org.springframework.cloud:spring-cloud-starter-config') 
    compile('org.springframework.cloud:spring-cloud-starter-hystrix') 
    testCompile('org.springframework.boot:spring-boot-starter-test') 
    compile ('org.springframework.cloud:spring-cloud-starter-hystrix-dashboard') 
    compile('org.springframework.cloud:spring-cloud-starter-sleuth') 
    compile('org.springframework.cloud:spring-cloud-starter-oauth2') 
    compile("org.springframework.cloud:spring-cloud-starter-feign") 
    } 

给出在一个场景中我被迫使用假死客户在我的OAuth库调用我的授权微服务和jar的依赖文件在下面给出

dependencies { 
    compile('org.springframework.cloud:spring-cloud-starter-oauth2:1.1.3.RELEASE') 
    compile('com.nimbusds:nimbus-jose-jwt:4.33') 
    compile group: 'org.springframework.cloud', name: 'spring-cloud-starter-feign', version: '1.3.1.RELEASE' 
    compile("org.springframework.cloud:spring-cloud-starter-feign") 
     } 

但是当我用我的服务部署新的jar文件时,fe在我的jar文件中实现的ign客户端无法正常工作。调用直接命中到后备服务。

我删除了这个假装客户端,并添加&在微服务中测试它,它工作正常。

请帮我解决这个问题

回答

0

我解决了这个问题。这是我的错。问题出在我的假装配置中。纠正相同。 而不是“价值”我用“名称”。

@FeignClient(value = "customer-service", fallback = CustomerFeignFallback.class, configuration = FeignConf.class) 
    public interface CustomerFeignClient { 

这适用于我。

相关问题