Skip to content

Commit

Permalink
⬆️ upgrade the project from sb 2.6.4 to sb 3.3.6 using openrewrite
Browse files Browse the repository at this point in the history
  • Loading branch information
Adnane Miliari committed Nov 27, 2024
1 parent 1fa9d73 commit 80b45eb
Show file tree
Hide file tree
Showing 31 changed files with 131 additions and 91 deletions.
14 changes: 8 additions & 6 deletions amqp/src/main/java/dev/nano/amqp/RabbitMQConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

@Configuration
public class RabbitMQConfig {
Expand All @@ -26,27 +27,28 @@ public RabbitMQConfig(ConnectionFactory connectionFactory) {
}

@Bean
public Queue notificationQueue() {
Queue notificationQueue() {
return new Queue(this.notificationQueue);
}

@Bean
public TopicExchange internalExchange() {
TopicExchange internalExchange() {
return new TopicExchange(this.internalExchange);
}

// bind queue to exchange with routing key
@Bean
public Binding binding() {
Binding binding() {
return BindingBuilder
.bind(notificationQueue())
.to(internalExchange())
.with(this.internalNotificationRoutingKey);
}

// Configure amqp template that allows to send messages
@Primary
@Bean
public AmqpTemplate amqpTemplate() {
AmqpTemplate amqpTemplate() {
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(jacksonConverter());
return rabbitTemplate;
Expand All @@ -55,7 +57,7 @@ public AmqpTemplate amqpTemplate() {
//Build the rabbit listener container & connect to RabbitMQ broker to listener message
// that allows to consume messages from queues (listener)
@Bean
public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory);
factory.setMessageConverter(jacksonConverter());
Expand All @@ -64,7 +66,7 @@ public SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory

// Jackson2JsonMessageConverter is used to convert messages to JSON format
@Bean
public MessageConverter jacksonConverter() {
MessageConverter jacksonConverter() {
MessageConverter jackson2JsonMessageConverter = new Jackson2JsonMessageConverter();
return jackson2JsonMessageConverter;
}
Expand Down
12 changes: 5 additions & 7 deletions customer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -53,7 +53,6 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -84,8 +83,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
Expand All @@ -103,6 +100,7 @@
<version>${lombok.mapstruct.binding.version}</version>
</path>
</annotationProcessorPaths>
<release>17</release>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
Expand All @@ -16,7 +16,7 @@
@EnableFeignClients(
basePackages = "dev.nano.clients"
)
@EnableEurekaClient
@EnableDiscoveryClient
@PropertySources({
@PropertySource("classpath:amqp-${spring.profiles.active}.properties"),
@PropertySource("classpath:clients-${spring.profiles.active}.properties")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;
import jakarta.persistence.*;

@Getter @Setter
@AllArgsConstructor @NoArgsConstructor
Expand Down
4 changes: 4 additions & 0 deletions customer/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ eureka:
defaultZone: http://localhost:8761/eureka
fetch-registry: true
register-with-eureka: true
logging:
pattern:
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

8 changes: 4 additions & 4 deletions eureka-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
<artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
</dependencies>
<build>
Expand Down
4 changes: 4 additions & 0 deletions eureka-server/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ eureka:
client:
fetch-registry: false
register-with-eureka: false
logging:
pattern:
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
8 changes: 4 additions & 4 deletions gateway/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
</dependencies>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

@SpringBootApplication
@EnableEurekaClient
@EnableDiscoveryClient
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
Expand Down
4 changes: 4 additions & 0 deletions gateway/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,7 @@ eureka:
defaultZone: http://localhost:8761/eureka
fetch-registry: true
register-with-eureka: true
logging:
pattern:
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
12 changes: 5 additions & 7 deletions notification/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -58,7 +58,6 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
Expand Down Expand Up @@ -90,8 +89,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
Expand All @@ -109,6 +106,7 @@
<version>${lombok.mapstruct.binding.version}</version>
</path>
</annotationProcessorPaths>
<release>17</release>
</configuration>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;

Expand All @@ -12,7 +12,7 @@
"dev.nano.amqp",
}
)
@EnableEurekaClient
@EnableDiscoveryClient
@PropertySources({
@PropertySource("classpath:amqp-${spring.profiles.active}.properties")
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;
import jakarta.persistence.*;
import java.time.LocalDateTime;

@Getter @Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AWSConfig(Environment environment) {
private static final String SECRET_KEY_BUCKET = "ACCESS_KEY_BUCKET";

@Bean
public AmazonSimpleEmailService emailService() {
AmazonSimpleEmailService emailService() {
AWSCredentials awsCredentials = new BasicAWSCredentials(
environment.getRequiredProperty(ACCESS_KEY_BUCKET),
environment.getRequiredProperty(SECRET_KEY_BUCKET)
Expand Down
8 changes: 6 additions & 2 deletions notification/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spring:
application:
name: notification
datasource:
url: jdbc:postgresql://localhost:5432/customer
url: jdbc:postgresql://localhost:5432/notification
username: postgres
password: password
zipkin:
Expand Down Expand Up @@ -48,4 +48,8 @@ rabbitmq:
queue:
notification: notification.queue
routing-key:
internal-notification: internal.notification.routing-key # how to bind the queue to the exchange
internal-notification: internal.notification.routing-key
logging:
pattern:
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]" # how to bind the queue to the exchange
12 changes: 5 additions & 7 deletions order/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-tracing-bridge-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-zipkin</artifactId>
<groupId>io.zipkin.reporter2</groupId>
<artifactId>zipkin-reporter-brave</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand All @@ -53,7 +53,6 @@
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.9.2</version>
</dependency>
<dependency>
<groupId>dev.nano</groupId>
Expand All @@ -80,8 +79,6 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<annotationProcessorPaths>
<path>
<groupId>org.mapstruct</groupId>
Expand All @@ -99,6 +96,7 @@
<version>${lombok.mapstruct.binding.version}</version>
</path>
</annotationProcessorPaths>
<release>17</release>
</configuration>
</plugin>
</plugins>
Expand Down
4 changes: 2 additions & 2 deletions order/src/main/java/dev/nano/order/OrderApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
Expand All @@ -13,7 +13,7 @@
"dev.nano.amqp"
}
)
@EnableEurekaClient
@EnableDiscoveryClient
@EnableFeignClients(
basePackages = "dev.nano.clients"
)
Expand Down
2 changes: 1 addition & 1 deletion order/src/main/java/dev/nano/order/OrderController.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import jakarta.validation.Valid;

import java.util.List;

Expand Down
2 changes: 1 addition & 1 deletion order/src/main/java/dev/nano/order/OrderEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import lombok.*;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;
import jakarta.persistence.*;
import java.time.LocalDateTime;

@Getter @Setter
Expand Down
4 changes: 4 additions & 0 deletions order/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ eureka:
defaultZone: http://localhost:8761/eureka
fetch-registry: true
register-with-eureka: true
logging:
pattern:
# Logging pattern containing traceId and spanId; no longer provided through Sleuth by default
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"
Loading

0 comments on commit 80b45eb

Please sign in to comment.