JAVA-38 Move all Spring Cloud Modules to Boot 2

This commit is contained in:
mikr 2020-07-15 22:12:07 +02:00
parent c3baa7b0a3
commit 7015c66691
14 changed files with 47 additions and 32 deletions

View File

@ -31,6 +31,7 @@
<dependency> <dependency>
<groupId>io.rest-assured</groupId> <groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId> <artifactId>rest-assured</artifactId>
<version>${rest-assured.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -10,9 +10,9 @@
<parent> <parent>
<groupId>com.baeldung</groupId> <groupId>com.baeldung</groupId>
<artifactId>parent-modules</artifactId> <artifactId>parent-boot-2</artifactId>
<version>1.0.0-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>../parent-boot-2</relativePath>
</parent> </parent>
<modules> <modules>
@ -56,17 +56,15 @@
</build> </build>
<properties> <properties>
<spring-session.version>1.2.2.RELEASE</spring-session.version> <spring-cloud-dependencies.version>Hoxton.SR4</spring-cloud-dependencies.version>
<spring-cloud-dependencies.version>Brixton.SR7</spring-cloud-dependencies.version> <spring-cloud-starter-config.version>2.2.3.RELEASE</spring-cloud-starter-config.version>
<spring-cloud-starter-config.version>1.2.2.RELEASE</spring-cloud-starter-config.version> <spring-cloud-config-server.version>2.2.3.RELEASE</spring-cloud-config-server.version>
<spring-cloud-config-server.version>1.2.2.RELEASE</spring-cloud-config-server.version> <spring-cloud-starter-eureka.version>1.4.7.RELEASE</spring-cloud-starter-eureka.version>
<spring-cloud-starter-eureka.version>2.0.2.RELEASE</spring-cloud-starter-eureka.version> <spring-cloud-starter-feign.version>1.4.7.RELEASE</spring-cloud-starter-feign.version>
<spring-cloud-starter-feign.version>1.4.6.RELEASE</spring-cloud-starter-feign.version> <spring-cloud-starter-hystrix.version>1.4.7.RELEASE</spring-cloud-starter-hystrix.version>
<spring-cloud-starter-hystrix.version>1.2.3.RELEASE</spring-cloud-starter-hystrix.version> <spring-cloud-stream.version>3.0.6.RELEASE</spring-cloud-stream.version>
<spring-cloud-stream.version>1.3.0.RELEASE</spring-cloud-stream.version> <spring-boot-starter-web.version>2.3.1.RELEASE</spring-boot-starter-web.version>
<spring-boot-starter-web.version>1.4.2.RELEASE</spring-boot-starter-web.version> <spring-boot-maven-plugin.version>2.3.1.RELEASE</spring-boot-maven-plugin.version>
<spring-boot-maven-plugin.version>1.4.2.RELEASE</spring-boot-maven-plugin.version>
<spring-cloud-starter-zuul.version>1.2.3.RELEASE</spring-cloud-starter-zuul.version>
</properties> </properties>
</project> </project>

View File

@ -4,12 +4,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import static org.springframework.boot.WebApplicationType.NONE;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
public class DiscoveryClientApplication { public class DiscoveryClientApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(DiscoveryClientApplication.class).web(true) new SpringApplicationBuilder(DiscoveryClientApplication.class).web(NONE)
.run(args); .run(args);
} }

View File

@ -1,13 +1,16 @@
package com.baeldung.spring.cloud.consul.health; package com.baeldung.spring.cloud.consul.health;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import static org.springframework.boot.WebApplicationType.NONE;
@SpringBootApplication @SpringBootApplication
public class ServiceDiscoveryApplication { public class ServiceDiscoveryApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(ServiceDiscoveryApplication.class).web(true) new SpringApplicationBuilder(ServiceDiscoveryApplication.class).web(NONE)
.run(args); .run(args);
} }

View File

@ -4,12 +4,14 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import static org.springframework.boot.WebApplicationType.NONE;
@SpringBootApplication @SpringBootApplication
@RestController @RestController
public class DistributedPropertiesApplication { public class DistributedPropertiesApplication {
public static void main(String[] args) { public static void main(String[] args) {
new SpringApplicationBuilder(DistributedPropertiesApplication.class).web(true) new SpringApplicationBuilder(DistributedPropertiesApplication.class).web(NONE)
.run(args); .run(args);
} }

View File

@ -36,18 +36,22 @@
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId> <artifactId>spring-cloud-starter-hystrix</artifactId>
<version>${spring-cloud-starter-hystrix.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix-dashboard</artifactId> <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
<version>${spring-cloud-starter-hystrix.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-feign</artifactId> <artifactId>spring-cloud-starter-feign</artifactId>
<version>${spring-cloud-starter-feign.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot-starter-web.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>

View File

@ -1,7 +1,7 @@
package com.baeldung.spring.cloud.hystrix.rest.consumer; package com.baeldung.spring.cloud.hystrix.rest.consumer;
import com.baeldung.spring.cloud.hystrix.rest.producer.GreetingController; import com.baeldung.spring.cloud.hystrix.rest.producer.GreetingController;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;

View File

@ -3,8 +3,8 @@ package com.baeldung.spring.cloud.hystrix.rest.consumer;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker; import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard; import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication
@EnableCircuitBreaker @EnableCircuitBreaker

View File

@ -28,13 +28,13 @@ public class MultipleOutputsServiceApplicationIntegrationTest {
@Test @Test
public void whenSendMessage_thenResponseIsInAOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anOutput(), 1); thenPayloadInChannelIs(pipe.anOutput(), "1");
} }
@Test @Test
public void whenSendMessage_thenResponseIsInAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), "11");
} }
private void whenSendMessage(Integer val) { private void whenSendMessage(Integer val) {
@ -43,7 +43,7 @@ public class MultipleOutputsServiceApplicationIntegrationTest {
.build()); .build());
} }
private void thenPayloadInChannelIs(MessageChannel channel, Integer expectedValue) { private void thenPayloadInChannelIs(MessageChannel channel, String expectedValue) {
Object payload = messageCollector.forChannel(channel) Object payload = messageCollector.forChannel(channel)
.poll() .poll()
.getPayload(); .getPayload();

View File

@ -28,13 +28,13 @@ public class MultipleOutputsWithConditionsServiceIntegrationTest {
@Test @Test
public void whenSendMessage_thenResponseIsInAOutput() { public void whenSendMessage_thenResponseIsInAOutput() {
whenSendMessage(1); whenSendMessage(1);
thenPayloadInChannelIs(pipe.anOutput(), 1); thenPayloadInChannelIs(pipe.anOutput(), "1");
} }
@Test @Test
public void whenSendMessage_thenResponseIsInAnotherOutput() { public void whenSendMessage_thenResponseIsInAnotherOutput() {
whenSendMessage(11); whenSendMessage(11);
thenPayloadInChannelIs(pipe.anotherOutput(), 11); thenPayloadInChannelIs(pipe.anotherOutput(), "11");
} }
private void whenSendMessage(Integer val) { private void whenSendMessage(Integer val) {
@ -43,7 +43,7 @@ public class MultipleOutputsWithConditionsServiceIntegrationTest {
.build()); .build());
} }
private void thenPayloadInChannelIs(MessageChannel channel, Integer expectedValue) { private void thenPayloadInChannelIs(MessageChannel channel, String expectedValue) {
Object payload = messageCollector.forChannel(channel) Object payload = messageCollector.forChannel(channel)
.poll() .poll()
.getPayload(); .getPayload();

View File

@ -35,6 +35,6 @@ public class MyLoggerApplicationIntegrationTest {
.poll() .poll()
.getPayload(); .getPayload();
assertEquals("[1]: This is my message", payload.toString()); assertEquals("{\"message\":\"[1]: This is my message\"}", payload.toString());
} }
} }

View File

@ -30,6 +30,10 @@
<artifactId>spring-boot-starter</artifactId> <artifactId>spring-boot-starter</artifactId>
<version>${spring-boot.version}</version> <version>${spring-boot.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId> <artifactId>spring-web</artifactId>
@ -56,7 +60,10 @@
<artifactId>spring-cloud-starter-feign</artifactId> <artifactId>spring-cloud-starter-feign</artifactId>
<version>${spring-cloud-starter-feign.version}</version> <version>${spring-cloud-starter-feign.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
@ -71,7 +78,6 @@
</dependencies> </dependencies>
<properties> <properties>
<spring-cloud-starter-feign.version>1.2.5.RELEASE</spring-cloud-starter-feign.version>
<hamcrest-core.version>1.3</hamcrest-core.version> <hamcrest-core.version>1.3</hamcrest-core.version>
</properties> </properties>

View File

@ -2,8 +2,8 @@ package com.baeldung.spring.cloud.greeting;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.cloud.netflix.feign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;

View File

@ -18,8 +18,7 @@
</modules> </modules>
<properties> <properties>
<spring-boot.version>1.5.2.RELEASE</spring-boot.version> <springframework.version>5.2.7.RELEASE</springframework.version>
<springframework.version>4.3.7.RELEASE</springframework.version>
<spring-cloud-starter-zookeeper-discovery.version>1.0.3.RELEASE</spring-cloud-starter-zookeeper-discovery.version> <spring-cloud-starter-zookeeper-discovery.version>1.0.3.RELEASE</spring-cloud-starter-zookeeper-discovery.version>
</properties> </properties>