在我的项目中,不同的服务被部署为微服务,授权和认证在一个公共的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文件中实现的假客户端不是working.The调用,而是直接调用回退服务。
我删除了这个伪装客户端,并在一个微服务中添加和测试了它,它工作得很好。
请帮我解决这个问题
发布于 2017-06-21 21:32:42
我解决了问题.It是我的错。问题出在我的feign配置中。更正了同样的问题。我用"name“代替了"value”。
@FeignClient(value = "customer-service", fallback = CustomerFeignFallback.class, configuration = FeignConf.class)
public interface CustomerFeignClient {这对我很有效。
https://stackoverflow.com/questions/44653495
复制相似问题