Skip to content

Commit 80b45eb

Browse files
author
Adnane Miliari
committed
⬆️ upgrade the project from sb 2.6.4 to sb 3.3.6 using openrewrite
1 parent 1fa9d73 commit 80b45eb

File tree

31 files changed

+131
-91
lines changed

31 files changed

+131
-91
lines changed

amqp/src/main/java/dev/nano/amqp/RabbitMQConfig.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import org.springframework.beans.factory.annotation.Value;
1010
import org.springframework.context.annotation.Bean;
1111
import org.springframework.context.annotation.Configuration;
12+
import org.springframework.context.annotation.Primary;
1213

1314
@Configuration
1415
public class RabbitMQConfig {
@@ -26,27 +27,28 @@ public RabbitMQConfig(ConnectionFactory connectionFactory) {
2627
}
2728

2829
@Bean
29-
public Queue notificationQueue() {
30+
Queue notificationQueue() {
3031
return new Queue(this.notificationQueue);
3132
}
3233

3334
@Bean
34-
public TopicExchange internalExchange() {
35+
TopicExchange internalExchange() {
3536
return new TopicExchange(this.internalExchange);
3637
}
3738

3839
// bind queue to exchange with routing key
3940
@Bean
40-
public Binding binding() {
41+
Binding binding() {
4142
return BindingBuilder
4243
.bind(notificationQueue())
4344
.to(internalExchange())
4445
.with(this.internalNotificationRoutingKey);
4546
}
4647

4748
// Configure amqp template that allows to send messages
49+
@Primary
4850
@Bean
49-
public AmqpTemplate amqpTemplate() {
51+
AmqpTemplate amqpTemplate() {
5052
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
5153
rabbitTemplate.setMessageConverter(jacksonConverter());
5254
return rabbitTemplate;
@@ -55,7 +57,7 @@ public AmqpTemplate amqpTemplate() {
5557
//Build the rabbit listener container & connect to RabbitMQ broker to listener message
5658
// that allows to consume messages from queues (listener)
5759
@Bean
58-
public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
60+
SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
5961
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
6062
factory.setConnectionFactory(connectionFactory);
6163
factory.setMessageConverter(jacksonConverter());
@@ -64,7 +66,7 @@ public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory
6466

6567
// Jackson2JsonMessageConverter is used to convert messages to JSON format
6668
@Bean
67-
public MessageConverter jacksonConverter() {
69+
MessageConverter jacksonConverter() {
6870
MessageConverter jackson2JsonMessageConverter = new Jackson2JsonMessageConverter();
6971
return jackson2JsonMessageConverter;
7072
}

customer/pom.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4040
</dependency>
4141
<dependency>
42-
<groupId>org.springframework.cloud</groupId>
43-
<artifactId>spring-cloud-starter-sleuth</artifactId>
42+
<groupId>io.micrometer</groupId>
43+
<artifactId>micrometer-tracing-bridge-brave</artifactId>
4444
</dependency>
4545
<dependency>
46-
<groupId>org.springframework.cloud</groupId>
47-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
46+
<groupId>io.zipkin.reporter2</groupId>
47+
<artifactId>zipkin-reporter-brave</artifactId>
4848
</dependency>
4949
<dependency>
5050
<groupId>org.springframework.boot</groupId>
@@ -53,7 +53,6 @@
5353
<dependency>
5454
<groupId>io.micrometer</groupId>
5555
<artifactId>micrometer-registry-prometheus</artifactId>
56-
<version>1.9.2</version>
5756
</dependency>
5857
<dependency>
5958
<groupId>org.springframework.boot</groupId>
@@ -84,8 +83,6 @@
8483
<artifactId>maven-compiler-plugin</artifactId>
8584
<version>${maven.compiler.version}</version>
8685
<configuration>
87-
<source>${maven.compiler.source}</source>
88-
<target>${maven.compiler.target}</target>
8986
<annotationProcessorPaths>
9087
<path>
9188
<groupId>org.mapstruct</groupId>
@@ -103,6 +100,7 @@
103100
<version>${lombok.mapstruct.binding.version}</version>
104101
</path>
105102
</annotationProcessorPaths>
103+
<release>17</release>
106104
</configuration>
107105
</plugin>
108106
</plugins>

customer/src/main/java/dev/nano/customer/CustomerApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5-
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
66
import org.springframework.cloud.openfeign.EnableFeignClients;
77
import org.springframework.context.annotation.PropertySource;
88
import org.springframework.context.annotation.PropertySources;
@@ -16,7 +16,7 @@
1616
@EnableFeignClients(
1717
basePackages = "dev.nano.clients"
1818
)
19-
@EnableEurekaClient
19+
@EnableDiscoveryClient
2020
@PropertySources({
2121
@PropertySource("classpath:amqp-${spring.profiles.active}.properties"),
2222
@PropertySource("classpath:clients-${spring.profiles.active}.properties")

customer/src/main/java/dev/nano/customer/CustomerEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import lombok.*;
44
import lombok.experimental.SuperBuilder;
55

6-
import javax.persistence.*;
6+
import jakarta.persistence.*;
77

88
@Getter @Setter
99
@AllArgsConstructor @NoArgsConstructor

customer/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ eureka:
4141
defaultZone: http://localhost:8761/eureka
4242
fetch-registry: true
4343
register-with-eureka: true
44+
logging:
45+
pattern:
46+
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
47+
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
4448

eureka-server/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
1818
</dependency>
1919
<dependency>
20-
<groupId>org.springframework.cloud</groupId>
21-
<artifactId>spring-cloud-starter-sleuth</artifactId>
20+
<groupId>io.micrometer</groupId>
21+
<artifactId>micrometer-tracing-bridge-brave</artifactId>
2222
</dependency>
2323
<dependency>
24-
<groupId>org.springframework.cloud</groupId>
25-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
24+
<groupId>io.zipkin.reporter2</groupId>
25+
<artifactId>zipkin-reporter-brave</artifactId>
2626
</dependency>
2727
</dependencies>
2828
<build>

eureka-server/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ eureka:
2121
client:
2222
fetch-registry: false
2323
register-with-eureka: false
24+
logging:
25+
pattern:
26+
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
27+
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

gateway/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
2222
</dependency>
2323
<dependency>
24-
<groupId>org.springframework.cloud</groupId>
25-
<artifactId>spring-cloud-starter-sleuth</artifactId>
24+
<groupId>io.micrometer</groupId>
25+
<artifactId>micrometer-tracing-bridge-brave</artifactId>
2626
</dependency>
2727
<dependency>
28-
<groupId>org.springframework.cloud</groupId>
29-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
28+
<groupId>io.zipkin.reporter2</groupId>
29+
<artifactId>zipkin-reporter-brave</artifactId>
3030
</dependency>
3131
</dependencies>
3232
<build>

gateway/src/main/java/dev/nano/gateway/GatewayApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5-
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
66

77
@SpringBootApplication
8-
@EnableEurekaClient
8+
@EnableDiscoveryClient
99
public class GatewayApplication {
1010
public static void main(String[] args) {
1111
SpringApplication.run(GatewayApplication.class, args);

gateway/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ eureka:
4646
defaultZone: http://localhost:8761/eureka
4747
fetch-registry: true
4848
register-with-eureka: true
49+
logging:
50+
pattern:
51+
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
52+
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

notification/pom.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4141
</dependency>
4242
<dependency>
43-
<groupId>org.springframework.cloud</groupId>
44-
<artifactId>spring-cloud-starter-sleuth</artifactId>
43+
<groupId>io.micrometer</groupId>
44+
<artifactId>micrometer-tracing-bridge-brave</artifactId>
4545
</dependency>
4646
<dependency>
47-
<groupId>org.springframework.cloud</groupId>
48-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
47+
<groupId>io.zipkin.reporter2</groupId>
48+
<artifactId>zipkin-reporter-brave</artifactId>
4949
</dependency>
5050
<dependency>
5151
<groupId>org.springframework.boot</groupId>
@@ -58,7 +58,6 @@
5858
<dependency>
5959
<groupId>io.micrometer</groupId>
6060
<artifactId>micrometer-registry-prometheus</artifactId>
61-
<version>1.9.2</version>
6261
</dependency>
6362
<dependency>
6463
<groupId>com.amazonaws</groupId>
@@ -90,8 +89,6 @@
9089
<artifactId>maven-compiler-plugin</artifactId>
9190
<version>${maven.compiler.version}</version>
9291
<configuration>
93-
<source>${maven.compiler.source}</source>
94-
<target>${maven.compiler.target}</target>
9592
<annotationProcessorPaths>
9693
<path>
9794
<groupId>org.mapstruct</groupId>
@@ -109,6 +106,7 @@
109106
<version>${lombok.mapstruct.binding.version}</version>
110107
</path>
111108
</annotationProcessorPaths>
109+
<release>17</release>
112110
</configuration>
113111
</plugin>
114112
</plugins>

notification/src/main/java/dev/nano/notification/NotificationApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5-
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
66
import org.springframework.context.annotation.PropertySource;
77
import org.springframework.context.annotation.PropertySources;
88

@@ -12,7 +12,7 @@
1212
"dev.nano.amqp",
1313
}
1414
)
15-
@EnableEurekaClient
15+
@EnableDiscoveryClient
1616
@PropertySources({
1717
@PropertySource("classpath:amqp-${spring.profiles.active}.properties")
1818
})

notification/src/main/java/dev/nano/notification/NotificationEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import lombok.*;
44
import lombok.experimental.SuperBuilder;
55

6-
import javax.persistence.*;
6+
import jakarta.persistence.*;
77
import java.time.LocalDateTime;
88

99
@Getter @Setter

notification/src/main/java/dev/nano/notification/aws/AWSConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public AWSConfig(Environment environment) {
2222
private static final String SECRET_KEY_BUCKET = "ACCESS_KEY_BUCKET";
2323

2424
@Bean
25-
public AmazonSimpleEmailService emailService() {
25+
AmazonSimpleEmailService emailService() {
2626
AWSCredentials awsCredentials = new BasicAWSCredentials(
2727
environment.getRequiredProperty(ACCESS_KEY_BUCKET),
2828
environment.getRequiredProperty(SECRET_KEY_BUCKET)

notification/src/main/resources/application.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spring:
1919
application:
2020
name: notification
2121
datasource:
22-
url: jdbc:postgresql://localhost:5432/customer
22+
url: jdbc:postgresql://localhost:5432/notification
2323
username: postgres
2424
password: password
2525
zipkin:
@@ -48,4 +48,8 @@ rabbitmq:
4848
queue:
4949
notification: notification.queue
5050
routing-key:
51-
internal-notification: internal.notification.routing-key # how to bind the queue to the exchange
51+
internal-notification: internal.notification.routing-key
52+
logging:
53+
pattern:
54+
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
55+
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]" # how to bind the queue to the exchange

order/pom.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@
3939
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4040
</dependency>
4141
<dependency>
42-
<groupId>org.springframework.cloud</groupId>
43-
<artifactId>spring-cloud-starter-sleuth</artifactId>
42+
<groupId>io.micrometer</groupId>
43+
<artifactId>micrometer-tracing-bridge-brave</artifactId>
4444
</dependency>
4545
<dependency>
46-
<groupId>org.springframework.cloud</groupId>
47-
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
46+
<groupId>io.zipkin.reporter2</groupId>
47+
<artifactId>zipkin-reporter-brave</artifactId>
4848
</dependency>
4949
<dependency>
5050
<groupId>org.springframework.boot</groupId>
@@ -53,7 +53,6 @@
5353
<dependency>
5454
<groupId>io.micrometer</groupId>
5555
<artifactId>micrometer-registry-prometheus</artifactId>
56-
<version>1.9.2</version>
5756
</dependency>
5857
<dependency>
5958
<groupId>dev.nano</groupId>
@@ -80,8 +79,6 @@
8079
<artifactId>maven-compiler-plugin</artifactId>
8180
<version>${maven.compiler.version}</version>
8281
<configuration>
83-
<source>${maven.compiler.source}</source>
84-
<target>${maven.compiler.target}</target>
8582
<annotationProcessorPaths>
8683
<path>
8784
<groupId>org.mapstruct</groupId>
@@ -99,6 +96,7 @@
9996
<version>${lombok.mapstruct.binding.version}</version>
10097
</path>
10198
</annotationProcessorPaths>
99+
<release>17</release>
102100
</configuration>
103101
</plugin>
104102
</plugins>

order/src/main/java/dev/nano/order/OrderApplication.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import org.springframework.boot.SpringApplication;
44
import org.springframework.boot.autoconfigure.SpringBootApplication;
5-
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
5+
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
66
import org.springframework.cloud.openfeign.EnableFeignClients;
77
import org.springframework.context.annotation.PropertySource;
88
import org.springframework.context.annotation.PropertySources;
@@ -13,7 +13,7 @@
1313
"dev.nano.amqp"
1414
}
1515
)
16-
@EnableEurekaClient
16+
@EnableDiscoveryClient
1717
@EnableFeignClients(
1818
basePackages = "dev.nano.clients"
1919
)

order/src/main/java/dev/nano/order/OrderController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import org.springframework.http.ResponseEntity;
99
import org.springframework.web.bind.annotation.*;
1010

11-
import javax.validation.Valid;
11+
import jakarta.validation.Valid;
1212

1313
import java.util.List;
1414

order/src/main/java/dev/nano/order/OrderEntity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import lombok.*;
44
import lombok.experimental.SuperBuilder;
55

6-
import javax.persistence.*;
6+
import jakarta.persistence.*;
77
import java.time.LocalDateTime;
88

99
@Getter @Setter

order/src/main/resources/application.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,7 @@ eureka:
4141
defaultZone: http://localhost:8761/eureka
4242
fetch-registry: true
4343
register-with-eureka: true
44+
logging:
45+
pattern:
46+
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
47+
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

0 commit comments

Comments
 (0)