spring-cloud

Spring Cloud Gateway - Proxy/Forward the entire sub part of URL

久未见 提交于 2021-02-06 15:15:42
问题 I am using Spring Cloud Gateway 2.0.0.M6 testing a simple gateway. I just want a URL to be forwarded to another URL with ** regex Example 1: /integration/sbl/foo/bar => localhost:4178/a-integration/sbl/foo/bar Example 2: /integration/sbl/baz/bad => localhost:4178/a-integration/sbl/baz/bad So far I have written the following, but it only forwards to http://localhost:4178/a-integration/ @Bean public RouteLocator routeLocator(RouteLocatorBuilder builder) { String test = "http://localhost:4178/a

Spring Cloud: How to use Feign without Ribbon

。_饼干妹妹 提交于 2021-02-05 20:22:13
问题 I would like to use Feign without client-side loadbalancer Ribbon because I don't want to run Eureka, which would need to be distributed and highly available. Instead internal ELBs with internal DNS names managed by Route53 will do just fine. Providing plain URLs to @FeignClient always results in no loadbalancer found for .. , so I tried preventing Feign from using Ribbon: Spring Cloud Netflix comes with FeignRibbonClient , which is used if ILoadBalancer from ribbon-loadbalancer is present.

Spring Cloud: How to use Feign without Ribbon

与世无争的帅哥 提交于 2021-02-05 20:21:24
问题 I would like to use Feign without client-side loadbalancer Ribbon because I don't want to run Eureka, which would need to be distributed and highly available. Instead internal ELBs with internal DNS names managed by Route53 will do just fine. Providing plain URLs to @FeignClient always results in no loadbalancer found for .. , so I tried preventing Feign from using Ribbon: Spring Cloud Netflix comes with FeignRibbonClient , which is used if ILoadBalancer from ribbon-loadbalancer is present.

Are there anyway to disable annotation in spring4?

流过昼夜 提交于 2021-02-05 04:48:37
问题 I have a question, maybe simple, but I can not find out the solution. I am using spring boot and added some annotation to the code like this: @EnableEurekaClient @SpringBootApplication @EnableCaching public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } But in some other environment, for example, in production environment, we want to remove EurekaClient, but I do not want to manually remove it manually for each environment,

Are there anyway to disable annotation in spring4?

醉酒当歌 提交于 2021-02-05 04:48:16
问题 I have a question, maybe simple, but I can not find out the solution. I am using spring boot and added some annotation to the code like this: @EnableEurekaClient @SpringBootApplication @EnableCaching public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class, args); } } But in some other environment, for example, in production environment, we want to remove EurekaClient, but I do not want to manually remove it manually for each environment,

java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder

China☆狼群 提交于 2021-01-29 12:39:06
问题 I am learning springboot and microservices. I have created 3 services and all are working fine. Now i have created discovery server, using start.spring.io by adding "Eureka Server" as dependency. My pom.xml is as follows: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0<

passing properties to child task of composed-task-runner app of spring cloud dataflow

∥☆過路亽.° 提交于 2021-01-29 06:18:07
问题 I am trying to run composed-task-runner of spring cloud data flow, which has 2 child tasks (A and B) within it. I am passing properties to my-composed-task, which has to be passed to child tasks too, but it is not passing into the child applications. Below are the commands which I am using: for the creation of task in dataflow shell: task create my-composed-task --definition "A && B" for launching the task in dataflow shell: task launch my-composed-task --arguments "--spring.cloud.task

Spring Cloud Contract with Jersey

爷,独闯天下 提交于 2021-01-29 03:30:02
问题 I have a simple project Spring boot project. It contains one Jersey based Controller: @Path("persons") @Produces(MediaType.APPLICATION_JSON) public class PersonsController { @GET public Person get() { return new Person("James", 20); } } It returns json response as expected (url: http://localhost:PORT/persons): { "name": "James", "age": 20 } My aim is to add Spring Cloud Contract tests for this controller. I have added all required mvn configurations, and test: public class MvcTest { @Before

Feign Client fails to compile, it treats BindingResult as a second Body parameter

走远了吗. 提交于 2021-01-28 19:33:30
问题 I'm learning to use Spring's Feign Client, so I've built two simple projects (serviceA and serviceB) to test it out. I have the following code: serviceA rest interface: @RequestMapping("/users") public interface UserRest { @PostMapping public ResponseEntity<User> createUser(@Valid @RequestBody User user, BindingResult br); } serviceA rest interface implementation: @RestController public class UserController implements UserRest { @Override @PostMapping public ResponseEntity<User> createUser(

Spring - service shuts down after being discovered by eureka server

无人久伴 提交于 2021-01-28 18:09:34
问题 My service "app-name" shuts down unexpectedly right after having started. At that time The eureka server is running on port 8761 The service has been successfully discovered by the eureka server (registration status: 204 , registering application with eureka with status UP ) The discovered app has fully started on port 9100 ( Started <app-name> in 7.427 seconds (JVM running for 7.999 ) If I don't include service discovery the app starts up fine Here is the java implementation //Eureka server