spring-cloud

How to implement OAuth2 “Token Exchange” with Spring Cloud Security

旧巷老猫 提交于 2019-12-03 02:14:36
I would like to know if someone has an example to see how to implement "Token Exchange" technique with Spring Cloud Security (with OAuth2). Currently I have implemented "Token Relay" technique in a Microservices Environment using ZuulProxy to "relay" the OAuth2 token and implementing SSO. This is great but implies that every microservice uses the same clientId (which is specified in ZuulProxy setup as ZuulProxy relays the token only with authorization_code grant type and the clientId provided). However, for intra-microservices calls I would like to "exchange" the token. This means in some

Can Zuul Edge Server be used without Eureka / Ribbon

北慕城南 提交于 2019-12-03 01:57:49
We have an infrastructure with service discovery and load balancing (i.e. server side with STM and weblogic cluster). Now we are in the process of refactoring into micro-services. We would need an API gateway which does basic routing to other microservices. Netflix Zuul looks a good candidate however I could not get Zuul working without Eureka - but we do not need Eureka since we already have service discovery and load balancing in place. Is it possible to use Zuul without Eureka and Ribbon? If yes please provide some guild-lines since the there's no mention about in the wiki. Thanks. Yes, it

How to register eureka-clients with eureka-server on different hosts. Spring-boot

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm running my eureka-server on my localhost. I'm able to register all my other on localhost running services and everthing works like expected. Now I want to register a service which is running on a linux machine. My properties looks like that: spring.application.name=myService-service spring.cloud.config.uri=http://myMachine.domain.lan:8888 server.port=8002 eureka.client.service-url.default-zone=http://myMachine.domain.lan:8761/eureka/ But the service is not able to register on eureka server on localhost. (At the end its the same service

Spring boot-Exception in thread “main” java.lang.NoSuchMethodError: org.springframew..(Version Issue)

匿名 (未验证) 提交于 2019-12-03 01:36:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting Exception while running server .I know it is version issue of Spring boot and spring-cloud . But I am using spring boot 1.4.2.RELEASE and currently spring cloud using Finchley.SR1 . What is suitable version of spring cloud with spring boot 1.4.2.RELEASE? Getting exception below: Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.<init>([Ljava/lang/Class;)V at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext

spring-cloud with RestTemplate//Ribbon/Eureka - retry when server not available

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I managed to successfully get my RestTemplate client discover remote service using Eureka and forward calls to it using Ribbon as described in the documentation. Basically, it was just a matter of adding the following annotations of my Application class and let the magic of Spring-Boot do the rest: @Configuration @ComponentScan @EnableAutoConfiguration @EnableDiscoveryClient (PS: you noticed I'm using spring-cloud:1.0.0-SNAPSHOT-BUILD and not 1.0.0.M3 - but this doesn't seem to affect my problem). When two service instances are started, the

Cannot find class org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration]

匿名 (未验证) 提交于 2019-12-03 01:00:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: While running Spring Boot application I am getting this issue: Exception in thread "main" java.lang.IllegalArgumentException: Cannot find class [org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:287) at org.springframework.cloud.bootstrap.BootstrapApplicationListener.bootstrapServiceContext(BootstrapApplicationListener.java:176) at org.springframework.cloud.bootstrap.BootstrapApplicationListener.onApplicationEvent

NoClassDefFoundError: NameCoder at Spring Cloud Brixton.SR7 and Spring Cloud Camden.SR3

匿名 (未验证) 提交于 2019-12-03 00:46:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: For all the Camden releases and now on the Brixton.SR7 as well, the following issue related to the Eureka Client occurs when starting the Spring Boot app: java.lang.NoClassDefFoundError: com/thoughtworks/xstream/io/naming/NameCoder For an instance I have a Spring Boot app having the @EnableDiscoveryClient annotation... Lately I’ve been changing the Spring Cloud dependencies back to Brixton.SR6 in order to get rid of this error. Certainly, I want to use the latest versions of the Spring Cloud but how could I fix this error the right way?

spring boot 2.0.3+spring cloud (Finchley)熔断器Hystrix

匿名 (未验证) 提交于 2019-12-03 00:37:01
在分布式系统中服务与服务之间的依赖错综复杂,一种不可避免的情况就是某些服务会出现故障,导致依赖于他们的其他服务出现远程调度的线程阻塞。某个服务的单个点的请求故障会导致用户的请求处于阻塞状态,最终的结果是整个服务的线程资源消耗殆尽。由于服务的依赖性,会导致依赖于该故障服务的其他服务也处于线程阻塞状态,最终导致这些服务的线程资源消耗殆尽,知道不可用,从而导致整个服务系统不可用,即雪崩效应。为了防止雪崩效应,产生了熔断器模型。 Hystrix是Netflix公司开源的一个项目,提供了熔断器功能,能阻止分布式系统中出现联动故障。Hystrix是通过隔离服务的访问点阻止联动故障的,并提供了故障解决方案,从而提高了整个分布式系统的弹性。 当服务的某个API接口的失败次数在一定时间内小于设定的阈值时,熔断器处于关闭状态,该API接口正常提供服务。当该API接口处理请求的失败次数大于设定的阈值时,hystrix判定该API接口出现了故障,打开熔断器,这时请求该API接口会执行快速失败的逻辑(即fallback回退的逻辑),不执行业务逻辑,请求的线程不会处于阻塞状态。处于打开状态的熔断器,一段时间后会处于半打开状态,并将一定数量的请求执行正常逻辑,剩余的请求会执行快速失败,若执行正常逻辑的请求失败了,则熔断器继续打开,若成功了,则关闭熔断器。这样熔断器就具有了自我修复的能力。

Spring Cloud Config + Spring Cloud Bus 实现配置文件动态刷新(版本 Finchley.RC1)

匿名 (未验证) 提交于 2019-12-03 00:34:01
Spring Cloud 应用篇 之 Spring Cloud Config(配置中心) 一文中介绍了 Spring Cloud Config 的使用,已经实现了配置文件的统一管理(git 仓库),但是,每次修改配置文件后,还需要重新启动应用才能加载到修改后的配置文件,这还没有达到我们的目的,我们最终想要的是,修改完配置文件后,不需要重启我们的应用,就可以重新加载到修改后的配置文件,其实 Spring Cloud 已经为我们提供了这样的支持,那就是 Spring Cloud Bus 组件。 (一)简介 下面是官方文档介绍,我们可以使用消息中间件 RabbitMQ 或者 Kafka,只需要在项目中引用相应的依赖。至于消息中间件的使用,可以查阅相关资料。 Spring Cloud Bus works by adding Spring Boot autconfiguration if it detects itself on the classpath. To enable the bus, add spring-cloud-starter-bus-amqp or spring-cloud-starter-bus-kafka to your dependency management. Spring Cloud takes care of the rest. Make sure the

SpringCloud(十五)springCloud sleuth 分布式链路跟踪

匿名 (未验证) 提交于 2019-12-03 00:29:01
前言: 一些感念: Span:基本工作单元,例如,在一个新建的span中发送一个RPC等同于发送一个回应请求给RPC,span通过一个64位ID唯一标识,trace以另一个64位ID表示,span还有其他数据信息,比如摘要、时间戳事件、关键值注释(tags)、span的ID、以及进度ID(通常是IP地址) span在不断的启动和停止,同时记录了时间信息,当你创建了一个span,你必须在未来的某个时刻停止它。 Trace:一系列spans组成的一个树状结构,例如,如果你正在跑一个分布式大数据工程,你可能需要创建一个trace。 Annotation:用来及时记录一个事件的存在,一些核心annotations用来定义一个请求的开始和结束 cs - Client Sent -客户端发起一个请求,这个annotion描述了这个span的开始 sr - Server Received -服务端获得请求并准备开始处理它,如果将其sr减去cs时间戳便可得到网络延迟 ss - Server Sent -注解表明请求处理的完成(当请求返回客户端),如果ss减去sr时间戳便可得到服务端需要的处理请求时间 cr - Client Received -表明span的结束,客户端成功接收到服务端的回复,如果cr减去cs时间戳便可得到客户端从服务端获取回复的所有所需时间