spring-cloud

Spring Cloud Config Client Without Spring Boot

↘锁芯ラ 提交于 2019-11-27 11:07:57
We have an existing spring web app deployed as a WAR file into Amazon Elastic Beanstalk. Currently we load properties files as http resources to give us a single source of property placeholder config resolution. Im investigating replacing this with the new spring cloud configuration server to give us the benefits of git versioning etc. However the documentation ( http://cloud.spring.io/spring-cloud-config/spring-cloud-config.html ) only seems to describe a Spring Boot client application. Is it possible to set up the Spring Cloud Config Client in an existing web app? Do I need to manually set

What is the difference between putting a property on application.yml or bootstrap.yml in spring boot?

天大地大妈咪最大 提交于 2019-11-27 09:08:29
问题 What is the difference between putting a property on application.yml or bootstrap.yml in spring boot? In logging.config case, the application works different. 回答1: I have just asked the Spring Cloud guys and thought I should share the info I have here. bootstrap.yml is loaded before application.yml . It is typically used for the following: when using Spring Cloud Config Server, you should specify spring.application.name and spring.cloud.config.server.git.uri inside bootstrap.yml some

spring cloud微服务实践五

て烟熏妆下的殇ゞ 提交于 2019-11-27 07:33:38
本篇我们来看看怎么实现spring cloud的配置中心. 在分布式系统中,特别是微服务架构下,可能会存在许多的服务,每个服务都会存在一个或多个的配置文件.那怎么多的配置文件的管理就会成为一个大问题.同时,微服务运行过程中还需要动态的修改配置参数.所以spring cloud config就是在spring cloud微服务架构中解决配置文件的管理,刷新,查看等问题的. 注:这一个系列的开发环境版本为 java1.8, spring boot2.x, spring cloud Greenwich.SR2, IDE为 Intelli IDEA 配置中心和git 我们先来一个简单的配置,只有server和config的. 添加配置文件 创建一个目录,目录下分别添加3个不同的配置文件 neo-config-dev.properties neo-config-pro.properties neo-config-test.properties 里面的配置分别为neo.hello=hello in dev/pro/test 并将目录保存到gitlee/github上. 这里我的地址是 https://gitlee.com/xingyys/config-repo server 端 接下来开始配置server pom <properties> <java.version>1.8</java

Spring Boot + Eureka Server + Hystrix with Turbine: empty turbine.stream

放肆的年华 提交于 2019-11-27 05:39:58
问题 I'm trying to run Spring Boot (with Spring Cloud) + Eureka Server + Hystrix Dashboard and Turbine stream, but I run into a problem I couldn't find any solution so far. I use Spring Boot 1.2.1.RELEASE and Spring Cloud 1.0.0.RC2 . Here is what I have: The first instance is running Eureka server and Hystrix dashboard: @Configuration @EnableAutoConfiguration @EnableEurekaServer @EnableHystrixDashboard @EnableDiscoveryClient class Application { public static void main(String[] args) {

Customizing Zuul Exception

时间秒杀一切 提交于 2019-11-27 04:25:09
I have a scenario in Zuul where the service that the URL is routed too might be down . So the reponse body gets thrown with 500 HTTP Status and ZuulException in the JSON body response. { "timestamp": 1459973637928, "status": 500, "error": "Internal Server Error", "exception": "com.netflix.zuul.exception.ZuulException", "message": "Forwarding error" } All I want to do is to customise or remove the JSON response and maybe change the HTTP status Code. I tried to create a exception Handler with @ControllerAdvice but the exception is not grabbed by the handler. UPDATES: So I extended the Zuul

Using @Headers with dynamic values in Feign client + Spring Cloud (Brixton RC2)

跟風遠走 提交于 2019-11-27 04:21:01
问题 Is it possible to set dynamic values to a header ? @FeignClient(name="Simple-Gateway") interface GatewayClient { @Headers("X-Auth-Token: {token}") @RequestMapping(method = RequestMethod.GET, value = "/gateway/test") String getSessionId(@Param("token") String token); } Registering an implementation of RequestInterceptor adds the header but there is no way of setting the header value dynamically @Bean public RequestInterceptor requestInterceptor() { return new RequestInterceptor() { @Override

How to get custom user info from OAuth2 authorization server /user endpoint

对着背影说爱祢 提交于 2019-11-27 03:51:37
I have a resource server configured with @EnableResourceServer annotation and it refers to authorization server via user-info-uri parameter as follows: security: oauth2: resource: user-info-uri: http://localhost:9001/user Authorization server /user endpoint returns an extension of org.springframework.security.core.userdetails.User which has e.g. an email: { "password":null, "username":"myuser", ... "email":"me@company.com" } Whenever some resource server endpoint is accessed Spring verifies the access token behind the scenes by calling the authorization server's /user endpoint and it actually

Spring-Cloud configuration server ignores configuration properties file

旧街凉风 提交于 2019-11-27 03:31:39
问题 I am trying to create a Spring Cloud configuration server which reads the configuration data from the properties file and not a github. The server starts, but does not serve the properties from the file. I have two configuration files on the classpapath: bootstrap.yml spring: application: name: config-server config-server.properties foo=bar when I go to the url which supposedly should give me the value of the foo property: curl http://localhost:8888/admin/env/foo I get an error: "timestamp"

Creating custom Zuul filters

怎甘沉沦 提交于 2019-11-27 02:59:17
问题 I want to implement custom filters for my Zuul proxy. Now, I know there has been a lot of talking about that subject here and I took a look at the answer provided, with the examples of filters and the Spring Cloud documentation, which I went through several times. I have tried to copy some of the filters content to my use, but it didn't work. I have a Eureka server, registering 3 separate services, one of them being the front door to the other two, collecting information from each of them and

Understanding Spring Cloud Eureka Server self preservation and renew threshold

自古美人都是妖i 提交于 2019-11-27 02:51:08
I am new to developing microservices, although I have been researching about it for a while, reading both Spring's docs and Netflix's. I have started a simple project available on Github . It is basically a Eureka server (Archimedes) and three Eureka client microservices (one public API and two private). Check github's readme for a detailed description. The point is that when everything is running I would like that if one of the private microservices is killed, the Eureka server realizes and removes it from the registry. I found this question on Stackoverflow , and the solution passes by using