首页 文章

假冒客户端无法加载服务

提问于
浏览
0

在我的项目中,不同的服务被部署为微服务,授权和身份验证在一个通用的jar文件中处理,该文件在每个微服务项目中作为依赖项添加 .

微服务之间的通信是通过假装客户端完成的

下面给出了这种服务的Gradle文件

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库中使用feign客户端来调用我的授权微服务,下面给出了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文件时,我的jar文件中实现的假装客户端无法正常工作 . 该调用直接被命中回到后备服务 .

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

请帮我解决这个问题

1 回答

  • 0

    我解决了这个问题 . 这是我的坏事 . 问题在于我的假装配置 . 纠正了同样的问题而不是“ Value ”我使用“名称” .

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

    这对我有用 .

相关问题