From d71e2b8ebc54e9a589b92dfb2439b3c934ee2a9e Mon Sep 17 00:00:00 2001 From: bsmahi Date: Thu, 20 Oct 2022 10:37:47 +0530 Subject: [PATCH 1/2] Upgrade to Spring Boot 3.0.0-M5 --- .gitignore | 2 + 03.microservices/api-gateway/pom.xml | 60 ++++++++++++++++--- .../currency-conversion-service/pom.xml | 33 +++++++++- .../CurrencyExchangeProxy.java | 4 +- .../currency-exchange-service/pom.xml | 32 +++++++++- .../CurrencyExchange.java | 8 +-- .../src/main/resources/application.properties | 4 ++ 03.microservices/limits-service/pom.xml | 21 ++++++- 03.microservices/naming-server/pom.xml | 32 +++++++++- .../spring-cloud-config-server/pom.xml | 28 ++++++++- .../src/main/resources/application.properties | 3 +- v3-upgrade.md | 54 +++++++++++++++++ 12 files changed, 250 insertions(+), 31 deletions(-) create mode 100644 v3-upgrade.md diff --git a/.gitignore b/.gitignore index e5629b8..0ffe842 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ bin # Ignore Mac system file .DS_Store +.idea +*.iml diff --git a/03.microservices/api-gateway/pom.xml b/03.microservices/api-gateway/pom.xml index 062c820..cbf6066 100644 --- a/03.microservices/api-gateway/pom.xml +++ b/03.microservices/api-gateway/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 3.0.0-M5 com.in28minutes.microservices @@ -15,8 +15,8 @@ Demo project for Spring Boot - 15 - 2020.0.0 + 17 + 2022.0.0-M5 @@ -36,16 +36,21 @@ org.springframework.cloud spring-cloud-starter-netflix-eureka-client - org.springframework.cloud - spring-cloud-starter-sleuth + spring-cloud-starter-bootstrap - - org.springframework.cloud - spring-cloud-sleuth-zipkin - + + + + + + + + + + org.springframework.amqp @@ -91,7 +96,44 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + spring-snapshots + Spring Snapshots + https://repo.spring.io/snapshot + + false + + + diff --git a/03.microservices/currency-conversion-service/pom.xml b/03.microservices/currency-conversion-service/pom.xml index a3202e3..40c84bc 100644 --- a/03.microservices/currency-conversion-service/pom.xml +++ b/03.microservices/currency-conversion-service/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 3.0.0-M5 com.in28minutes.microservices @@ -15,8 +15,8 @@ Demo project for Spring Boot - 15 - 2020.0.0 + 17 + 2022.0.0-M5 @@ -41,6 +41,11 @@ org.springframework.cloud spring-cloud-starter-openfeign + + org.springframework.cloud + spring-cloud-starter-bootstrap + + org.springframework.cloud @@ -97,7 +102,29 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/03.microservices/currency-conversion-service/src/main/java/com/in28minutes/microservices/currencyconversionservice/CurrencyExchangeProxy.java b/03.microservices/currency-conversion-service/src/main/java/com/in28minutes/microservices/currencyconversionservice/CurrencyExchangeProxy.java index 434be9f..c128721 100644 --- a/03.microservices/currency-conversion-service/src/main/java/com/in28minutes/microservices/currencyconversionservice/CurrencyExchangeProxy.java +++ b/03.microservices/currency-conversion-service/src/main/java/com/in28minutes/microservices/currencyconversionservice/CurrencyExchangeProxy.java @@ -5,8 +5,8 @@ import org.springframework.web.bind.annotation.PathVariable; -//@FeignClient(name="currency-exchange", url="localhost:8000") -@FeignClient(name="currency-exchange") +@FeignClient(name="currency-exchange", url="localhost:8000") +// @FeignClient(name="currency-exchange") public interface CurrencyExchangeProxy { @GetMapping("/currency-exchange/from/{from}/to/{to}") diff --git a/03.microservices/currency-exchange-service/pom.xml b/03.microservices/currency-exchange-service/pom.xml index f45c95d..4dc713e 100644 --- a/03.microservices/currency-exchange-service/pom.xml +++ b/03.microservices/currency-exchange-service/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 3.0.0-M5 com.in28minutes.microservices @@ -15,8 +15,8 @@ Demo project for Spring Boot - 15 - 2020.0.0 + 17 + 2022.0.0-M5 @@ -32,6 +32,10 @@ org.springframework.boot spring-boot-starter-data-jpa + + org.springframework.cloud + spring-cloud-starter-bootstrap + com.h2database h2 @@ -111,7 +115,29 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/03.microservices/currency-exchange-service/src/main/java/com/in28minutes/microservices/currencyexchangeservice/CurrencyExchange.java b/03.microservices/currency-exchange-service/src/main/java/com/in28minutes/microservices/currencyexchangeservice/CurrencyExchange.java index 887cf7a..3d3c619 100644 --- a/03.microservices/currency-exchange-service/src/main/java/com/in28minutes/microservices/currencyexchangeservice/CurrencyExchange.java +++ b/03.microservices/currency-exchange-service/src/main/java/com/in28minutes/microservices/currencyexchangeservice/CurrencyExchange.java @@ -1,10 +1,10 @@ package com.in28minutes.microservices.currencyexchangeservice; import java.math.BigDecimal; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Id; +// Changed from javax to jakarta +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; @Entity public class CurrencyExchange { diff --git a/03.microservices/currency-exchange-service/src/main/resources/application.properties b/03.microservices/currency-exchange-service/src/main/resources/application.properties index 9b466f0..35a739e 100644 --- a/03.microservices/currency-exchange-service/src/main/resources/application.properties +++ b/03.microservices/currency-exchange-service/src/main/resources/application.properties @@ -2,7 +2,11 @@ spring.application.name=currency-exchange server.port=8000 spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true +logging.level.org.hibernate.type=trace spring.datasource.url=jdbc:h2:mem:testdb +spring.data.jpa.repositories.bootstrap-mode=default +spring.jpa.defer-datasource-initialization=true spring.h2.console.enabled=true eureka.client.serviceUrl.defaultZone=http://localhost:8761/eureka diff --git a/03.microservices/limits-service/pom.xml b/03.microservices/limits-service/pom.xml index cd14ac9..5f6afd7 100644 --- a/03.microservices/limits-service/pom.xml +++ b/03.microservices/limits-service/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 2.7.0 com.in28minutes.microservices @@ -15,8 +15,8 @@ Demo project for Spring Boot Centralized Configuration - 15 - 2020.0.0 + 17 + 2021.0.3 @@ -72,7 +72,22 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + diff --git a/03.microservices/naming-server/pom.xml b/03.microservices/naming-server/pom.xml index 17938c8..1cddc50 100644 --- a/03.microservices/naming-server/pom.xml +++ b/03.microservices/naming-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 3.0.0-M5 com.in28minutes.microservices @@ -15,8 +15,8 @@ Demo project for Spring Boot - 15 - 2020.0.0 + 17 + 2022.0.0-M5 @@ -32,6 +32,10 @@ org.springframework.cloud spring-cloud-starter-netflix-eureka-server + + org.springframework.cloud + spring-cloud-starter-bootstrap + org.springframework.boot @@ -72,7 +76,29 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/03.microservices/spring-cloud-config-server/pom.xml b/03.microservices/spring-cloud-config-server/pom.xml index 42fc879..9ca2f90 100644 --- a/03.microservices/spring-cloud-config-server/pom.xml +++ b/03.microservices/spring-cloud-config-server/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 2.4.1 + 3.0.0-M5 com.in28minutes.microservices @@ -15,8 +15,8 @@ Centralized Configuration Server - 15 - 2020.0.0 + 17 + 2022.0.0-M5 @@ -64,7 +64,29 @@ spring-milestones Spring Milestones https://repo.spring.io/milestone + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + diff --git a/03.microservices/spring-cloud-config-server/src/main/resources/application.properties b/03.microservices/spring-cloud-config-server/src/main/resources/application.properties index b65796d..bbbd8fa 100644 --- a/03.microservices/spring-cloud-config-server/src/main/resources/application.properties +++ b/03.microservices/spring-cloud-config-server/src/main/resources/application.properties @@ -1,4 +1,5 @@ spring.application.name=spring-cloud-config-server server.port=8888 -spring.cloud.config.server.git.uri=file:///in28Minutes/git/spring-microservices-v2/03.microservices/git-localconfig-repo +#spring.cloud.config.server.git.uri=file:///in28Minutes/git/spring-microservices-v2/03.microservices/git-localconfig-repo +spring.cloud.config.server.git.uri=file:///Users/puneethsai/microservices/git-config-repo #file:///C:/Users/home/Desktop/yourProject/git-repo diff --git a/v3-upgrade.md b/v3-upgrade.md new file mode 100644 index 0000000..93e6d0d --- /dev/null +++ b/v3-upgrade.md @@ -0,0 +1,54 @@ +# NOTE: Spring Cloud 2022.0.0-M5 is not compatible with boot snapshots. Use 3.0.0-M5 +## 1. Change Spring Boot version as 3.0.0-M5 +```xml + + org.springframework.boot + spring-boot-starter-parent + 3.0.0-M5 + + +``` +## 2. Change Java version as 17 and Spring Cloud Version as 2022.0.0-M5 +```xml + + 17 + 2022.0.0-M5 + +``` +## 3. Change repository and plugin repository tags as below +```xml + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + netflix-candidates + Netflix Candidates + https://artifactory-oss.prod.netflix.net/artifactory/maven-oss-candidates + + false + + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + +``` +## 4. For more details please refer to spring cloud release notes: +https://github.com/spring-cloud/spring-cloud-netflix/issues/4128 + +https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2022.0-Release-Notes#202200-m5 \ No newline at end of file From 476e7a135de809ade56d88507f23ccd0a5890646 Mon Sep 17 00:00:00 2001 From: bsmahi Date: Thu, 20 Oct 2022 10:44:20 +0530 Subject: [PATCH 2/2] Modified v3-upgrade with javax to jakarta package info --- v3-upgrade.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/v3-upgrade.md b/v3-upgrade.md index 93e6d0d..57103d1 100644 --- a/v3-upgrade.md +++ b/v3-upgrade.md @@ -48,7 +48,13 @@ ``` -## 4. For more details please refer to spring cloud release notes: +## 5. Change from `javax` package to `jakarta` package in the entity classes +```java +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.Id; +``` +## 6. For more details please refer to spring cloud release notes: https://github.com/spring-cloud/spring-cloud-netflix/issues/4128 https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2022.0-Release-Notes#202200-m5 \ No newline at end of file