spring-cloud

spring-cloud-config client without Spring Boot

☆樱花仙子☆ 提交于 2019-12-01 19:16:53
I am just getting into spring-cloud-config and I'm working on this basic project . I would like to know if it is possible and how to rewrite this client to not use Spring Boot. import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.annotation.ComponentScan; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind

spring-cloud-config client without Spring Boot

前提是你 提交于 2019-12-01 18:15:59
问题 I am just getting into spring-cloud-config and I'm working on this basic project. I would like to know if it is possible and how to rewrite this client to not use Spring Boot. import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.cloud.context.config.annotation.RefreshScope; import org.springframework.context.annotation.ComponentScan; import

Adding Headers to Zuul when re-directing

微笑、不失礼 提交于 2019-12-01 18:09:07
I am trying to use Zuul to redirect calls to a downstream system somewhere else. In the re-direct, I need to add in a Header with necessary data for the api receiving the redirection to process. I can't seem to get the downstream system to detect this data. Attached is my code. I am using Zuul from Edgware.SR3, Spring Boot 1.5.12 Zuul Filter @Component public class RouteFilter extends ZuulFilter{ @Override public Object run() { //Testing to add header context.getRequest().getParameterMap().put("api", new String[]{"api"}); context.getResponse().setHeader("api", api); context

SpringCloud-使用熔断器防止服务雪崩-Ribbon和Feign方式(附代码下载)

青春壹個敷衍的年華 提交于 2019-12-01 17:29:27
场景 SpringCloud-服务注册与实现-Eureka创建服务注册中心(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102535957 SpringCloud-服务注册与实现-Eureka创建服务提供者(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102558004 SpringCloud-创建服务消费者-Ribbon方式(附代码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102558080 SpringCloud-创建服务消费者-Feign方式(附代码下载):: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102595895 在上面已经实现服务注册中心、服务提供者和以Ribbon方式和Fign方式实现服务消费者的前提下,使用熔断器防止服务雪崩。 在微服务架构中,根据业务来拆分成一个个的服务,服务与服务之间可以通过 RPC 相互调用,在 Spring Cloud 中可以用 RestTemplate + Ribbon 和 Feign 来调用

SpringCloud-创建服务消费者-Feign方式(附代码下载)

£可爱£侵袭症+ 提交于 2019-12-01 13:39:52
场景 SpringCloud-服务注册与实现-Eureka创建服务注册中心(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102535957 SpringCloud-服务注册与实现-Eureka创建服务提供者(附源码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102558004 SpringCloud-创建服务消费者-Ribbon方式(附代码下载): https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102558080 在上面已经实现服务注册中心、服务提供者和以Ribbon方式实现服务消费者的前提下,使用另一种Feign方式实现服务消费者。 Feign Feign 是一个声明式的伪 Http 客户端,它使得写 Http 客户端变得更简单。使用 Feign,只需要创建一个接口并注解。它具有可插拔的注解特性,可使用 Feign 注解和 JAX-RS 注解。Feign 支持可插拔的编码器和解码器。Feign 默认集成了 Ribbon,并和 Eureka 结合,默认实现了负载均衡的效果 注: 博客: https://blog.csdn.net/badao

Overriding Zuul Filter SendErrorFilter

时光怂恿深爱的人放手 提交于 2019-12-01 13:26:03
The class org.springframework.cloud.netflix.zuul.filters.post.SendErrorFilter handles error responses. I would like to override this filter to do a custom response instead of the ZuulException while forwarding etc. How can I replace this with my own version? Just write and register? Would that do it or is there something else needed? all you need to do is create a ZuulFilter and expose it as an @Bean . It needs to be in order before SendErrorFilter which is set to 0 . You might need to remove "error.status_code" from the RequestContext so SendErrorFilter doesn't run. You will need to disable a

Spring Cloud Stream @SendTo Annotation not working

自闭症网瘾萝莉.ら 提交于 2019-12-01 12:30:55
I'm using Spring Cloud Stream with Spring Boot. My application is very simple: ExampleService.class: @EnableBinding(Processor1.class) @Service public class ExampleService { @StreamListener(Processor1.INPUT) @SendTo(Processor1.OUTPUT) public String dequeue(String message){ System.out.println("New message: " + message); return message; } @SendTo(Processor1.OUTPUT) public String queue(String message){ return message; } } Procesor1.class: public interface Processor1 { String INPUT = "input1"; String OUTPUT = "output1"; @Input(Processor1.INPUT) SubscribableChannel input1(); @Output(Processor1

Refresh of Zuul configuration when using Spring Config Service

别等时光非礼了梦想. 提交于 2019-12-01 12:17:32
We have a Zuul proxy (wraped with Spring Cloud/Boot) deployed that fetches configuration from the Spring Config Server. Every time I do changes in the routes I restart Zuul application and I wonder if there is a better approach that can be taken (like refresh of Zuul config information)? :) Thank you, You can issue a refresh command via rest: curl -X POST http://<host>:<port>/refresh I wrote a simple bash script that commits all my changes to the config file in the Git repository and then issue curl request to all my services. If you wanted to be fancy you could write a script that first

Spring Cloud Stream @SendTo Annotation not working

我的梦境 提交于 2019-12-01 12:00:10
问题 I'm using Spring Cloud Stream with Spring Boot. My application is very simple: ExampleService.class: @EnableBinding(Processor1.class) @Service public class ExampleService { @StreamListener(Processor1.INPUT) @SendTo(Processor1.OUTPUT) public String dequeue(String message){ System.out.println("New message: " + message); return message; } @SendTo(Processor1.OUTPUT) public String queue(String message){ return message; } } Procesor1.class: public interface Processor1 { String INPUT = "input1";

Oauth2 client logout doesn't work

我是研究僧i 提交于 2019-12-01 11:20:40
I try to use the approach, described here https://spring.io/guides/tutorials/spring-boot-oauth2/#_social_login_logout : So I have following backend codebase: @EnableAutoConfiguration @Configuration @EnableOAuth2Sso @Controller public class ClientApplication extends WebSecurityConfigurerAdapter { private Logger logger = LoggerFactory.getLogger(ClientApplication.class); @RequestMapping("/hello") public String home(Principal user, HttpServletRequest request, HttpServletResponse response, Model model) throws ServletException { model.addAttribute("name", user.getName()); return "hello"; } @Override