-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(dependency): upgrade spring boot from 2.7.x to 3.0.x and spring cloud from 2021.0.x to 2022.0.x #1196
Draft
j-sandy
wants to merge
5
commits into
spinnaker:master
Choose a base branch
from
j-sandy:sb-3-0-13
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… cloud from 2021.0.x to 2022.0.x Upgrading spring boot 2.7.18 to 3.0.13 and spring cloud 2021.0.8 to 2022.0.5. Spring cloud release 2022.0.x is compatible with spring boot 3.0.x. https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions#supported-releases ====================================================== refactor(dependency): replace javax with jakarta during upgrade of spring boot 3.0.x Spring Boot 3.0 has migrated from Java EE to Jakarta EE APIs for all dependencies. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes#third-party-library-upgrades So, replacing the imports with `javax` to `jakarta`.
…ng boot 3.0.x Spring boot upgrade from 2.7.18 to 3.0.13, upgrades `redis.clients:jedis` from 3.8.0 to 4.3.2. So, migrating jedis from 3.x to 4.x by following the migration [document](https://github.com/redis/jedis/blob/master/docs/3to4.md) And for further changelogs, please refer [here](https://github.com/redis/jedis/releases/tag/v4.0.0)
dbyron-sf
reviewed
Dec 28, 2024
fiat-api/src/main/java/com/netflix/spinnaker/fiat/shared/FiatAuthenticationConfig.java
Outdated
Show resolved
Hide resolved
….x to 6.x with spring boot upgrade to 3.x With spring boot upgrade, spring security also upgrades from 5.x to 6.x. As per the migration [steps](https://www.baeldung.com/spring-security-migrate-5-to-6), `WebSecurityConfigurerAdapter` has been removed. So, it is not required to be extended, instead bean can be registered. `WebMvcConfigurerAdapter` class has been deprecated in Spring 5.0 and subsequently removed from spring 6.0. So, replacing it with `WebMvcConfigurer` interface for direct implementation. https://docs.spring.io/spring-framework/docs/5.0.0.RELEASE/javadoc-api/org/springframework/web/servlet/config/annotation/WebMvcConfigurerAdapter.html Removing bean of WebSecurityConfigurerAdapter, as in spring security 6.0 it is no more required. spring-projects/spring-security#11923 https://www.baeldung.com/spring-security-migrate-5-to-6#2-websecurityconfigureradapter
…ing boot upgrade to 3.x With spring boot upgrade, spring framework also upgrades from 5.x to 6.x. In spring framework 6.0, the trailing slash matching configuration option has been deprecated and its default value set to false. https://github.com/spring-projects/spring-framework/wiki/Spring-Framework-6.0-Release-Notes#web-applications Due to this change, encountered the below test failure: ``` Condition failed with Exception: mockMvc.perform(get("/authorize/")) .andExpect(status().isOk()) .andExpect(content().json(expected)) | | | | | | | | | | | <org.springframework.test.web.servlet.result.StatusResultMatchers$$Lambda$1833/0x0000000801998000@1cadc7c1 arg$1=200 OK> | | | | <org.springframework.test.web.servlet.result.StatusResultMatchers@34106ddc> | | | java.lang.AssertionError: Status expected:<200> but was:<404> | | | at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59) | | | at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122) | | | at org.springframework.test.web.servlet.result.StatusResultMatchers.lambda$matcher$9(StatusResultMatchers.java:637) | | | at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:214) | | | at com.netflix.spinnaker.fiat.controllers.AuthorizeControllerSpec.should get user from repo via endpoint(AuthorizeControllerSpec.groovy:180) | | <org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder@4c5c8926 method=GET url=/authorize/ contextPath= servletPath= pathInfo=/authorize/ secure=null principal=null session=null remoteAddress=null characterEncoding=null content=[] contentType=application/json headers=[:] parameters=[:] queryParams=[:] cookies=[] locales=[] requestAttributes=[:] sessionAttributes=[:] flashAttributes=[:] postProcessors=[]> | <org.springframework.test.web.servlet.MockMvc$1@6a230707 val$mvcResult=org.springframework.test.web.servlet.DefaultMvcResult@5ed59e7f this$0=org.springframework.test.web.servlet.MockMvc@27477eb7> <org.springframework.test.web.servlet.MockMvc@27477eb7 servlet=org.springframework.test.web.servlet.TestDispatcherServlet@512efef4 filters=[] servletContext=org.springframework.boot.test.mock.web.SpringBootMockServletContext@1cf516fa defaultRequestBuilder=org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder@5b96272e defaultResponseCharacterEncoding=null defaultResultMatchers=[] defaultResultHandlers=[]> Condition failed with Exception: mockMvc.perform(get("/authorize/")) .andExpect(status().isOk()) .andExpect(content().json(expected)) | | | | | | | | | | | <org.springframework.test.web.servlet.result.StatusResultMatchers$$Lambda$1833/0x0000000801998000@1cadc7c1 arg$1=200 OK> | | | | <org.springframework.test.web.servlet.result.StatusResultMatchers@34106ddc> | | | java.lang.AssertionError: Status expected:<200> but was:<404> | | | at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59) | | | at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122) | | | at org.springframework.test.web.servlet.result.StatusResultMatchers.lambda$matcher$9(StatusResultMatchers.java:637) | | | at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:214) | | | at com.netflix.spinnaker.fiat.controllers.AuthorizeControllerSpec.should get user from repo via endpoint(AuthorizeControllerSpec.groovy:180) | | <org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder@4c5c8926 method=GET url=/authorize/ contextPath= servletPath= pathInfo=/authorize/ secure=null principal=null session=null remoteAddress=null characterEncoding=null content=[] contentType=application/json headers=[:] parameters=[:] queryParams=[:] cookies=[] locales=[] requestAttributes=[:] sessionAttributes=[:] flashAttributes=[:] postProcessors=[]> | <org.springframework.test.web.servlet.MockMvc$1@6a230707 val$mvcResult=org.springframework.test.web.servlet.DefaultMvcResult@5ed59e7f this$0=org.springframework.test.web.servlet.MockMvc@27477eb7> <org.springframework.test.web.servlet.MockMvc@27477eb7 servlet=org.springframework.test.web.servlet.TestDispatcherServlet@512efef4 filters=[] servletContext=org.springframework.boot.test.mock.web.SpringBootMockServletContext@1cf516fa defaultRequestBuilder=org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder@5b96272e defaultResponseCharacterEncoding=null defaultResultMatchers=[] defaultResultHandlers=[]> at com.netflix.spinnaker.fiat.controllers.AuthorizeControllerSpec.should get user from repo via endpoint(AuthorizeControllerSpec.groovy:181) Caused by: java.lang.AssertionError: Status expected:<200> but was:<404> at org.springframework.test.util.AssertionErrors.fail(AssertionErrors.java:59) at org.springframework.test.util.AssertionErrors.assertEquals(AssertionErrors.java:122) at org.springframework.test.web.servlet.result.StatusResultMatchers.lambda$matcher$9(StatusResultMatchers.java:637) at org.springframework.test.web.servlet.MockMvc$1.andExpect(MockMvc.java:214) at com.netflix.spinnaker.fiat.controllers.AuthorizeControllerSpec.should get user from repo via endpoint(AuthorizeControllerSpec.groovy:180) ``` In order to fix this issue, removed the trailing slash from the mock url `/authorize`.
…spring boot upgrade to 3.x While upgrading the spring boot to 3.0.13 and spring cloud 2022.0.5, encountered the below error: ``` > Task :fiat-sql:compileKotlin FAILED e: /fiat/fiat-sql/src/main/kotlin/com/netflix/spinnaker/fiat/permissions/SqlPermissionsRepository.kt: (36, 11): Unresolved reference: vavr e: /fiat/fiat-sql/src/main/kotlin/com/netflix/spinnaker/fiat/permissions/SqlPermissionsRepository.kt: (49, 25): Unresolved reference: PreDestroy e: /fiat/fiat-sql/src/main/kotlin/com/netflix/spinnaker/fiat/permissions/SqlPermissionsRepository.kt: (550, 13): Unresolved reference: Try e: /fiat/fiat-sql/src/main/kotlin/com/netflix/spinnaker/fiat/permissions/SqlPermissionsRepository.kt: (561, 13): Unresolved reference: Try e: /fiat/fiat-sql/src/main/kotlin/com/netflix/spinnaker/fiat/permissions/SqlPermissionsRepository.kt: (599, 6): Unresolved reference: PreDestroy FAILURE: Build completed with 2 failures. ``` The root cause of this issue is removal of `io.vavr` dependency from resilience4j:2.0.2. https://github.com/resilience4j/resilience4j/releases/tag/v2.0.0 Resilience4j comes as transitive dependency of spring-cloud-dependencies. https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-dependencies/2022.0.5 Dependency insight before spring cloud upgrade: ``` $ ./gradlew fiat-sql:dI --dependency io.vavr:vavr: > Task :fiat-sql:dependencyInsight io.vavr:vavr:0.10.2 Variant compile: | Attribute Name | Provided | Requested | |------------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 17 | | org.jetbrains.kotlin.platform.type | | jvm | io.vavr:vavr:0.10.2 +--- io.github.resilience4j:resilience4j-annotations:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 | | \--- compileClasspath | +--- io.spinnaker.kork:kork-core:7.247.0 | | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | | +--- io.spinnaker.kork:kork-sql:7.247.0 | | | +--- compileClasspath (requested io.spinnaker.kork:kork-sql) | | | \--- io.spinnaker.kork:kork-bom:7.247.0 (*) | | \--- io.spinnaker.kork:kork-web:7.247.0 | | +--- compileClasspath (requested io.spinnaker.kork:kork-web) | | \--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-spring:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-spring-boot2:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.spinnaker.kork:kork-core:7.247.0 (*) +--- io.github.resilience4j:resilience4j-bulkhead:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-framework-common:1.7.0 | \--- io.github.resilience4j:resilience4j-spring:1.7.0 (*) +--- io.github.resilience4j:resilience4j-circuitbreaker:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) +--- io.github.resilience4j:resilience4j-circularbuffer:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-consumer:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-spring:1.7.0 (*) +--- io.github.resilience4j:resilience4j-consumer:1.7.0 (*) +--- io.github.resilience4j:resilience4j-core:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | +--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) | +--- io.github.resilience4j:resilience4j-retry:1.7.0 | | +--- compileClasspath (requested io.github.resilience4j:resilience4j-retry) | | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | | +--- io.spinnaker.kork:kork-core:7.247.0 (*) | | \--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) | +--- io.github.resilience4j:resilience4j-consumer:1.7.0 (*) | +--- io.github.resilience4j:resilience4j-circuitbreaker:1.7.0 (*) | +--- io.github.resilience4j:resilience4j-ratelimiter:1.7.0 | | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | | \--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) | +--- io.github.resilience4j:resilience4j-bulkhead:1.7.0 (*) | \--- io.github.resilience4j:resilience4j-timelimiter:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) +--- io.github.resilience4j:resilience4j-framework-common:1.7.0 (*) +--- io.github.resilience4j:resilience4j-micrometer:1.7.0 | +--- io.spinnaker.kork:kork-bom:7.247.0 (*) | \--- io.github.resilience4j:resilience4j-spring-boot2:1.7.0 (*) +--- io.github.resilience4j:resilience4j-ratelimiter:1.7.0 (*) +--- io.github.resilience4j:resilience4j-retry:1.7.0 (*) +--- io.github.resilience4j:resilience4j-spring:1.7.0 (*) +--- io.github.resilience4j:resilience4j-spring-boot2:1.7.0 (*) \--- io.github.resilience4j:resilience4j-timelimiter:1.7.0 (*) ``` After spring cloud upgrade: ``` $ ./gradlew fiat-sql:dI --dependency io.vavr:vavr: > Task :fiat-sql:dependencyInsight No dependencies matching given input were found in configuration ':fiat-sql:compileClasspath' ``` In order to fix this issue adding explicit dependency of `resilience4j-vavr`. After adding dependency: ``` $ ./gradlew fiat-sql:dI --dependency io.vavr:vavr: > Task :fiat-sql:dependencyInsight io.vavr:vavr:0.10.2 Variant compile: | Attribute Name | Provided | Requested | |------------------------------------|----------|-------------------| | org.gradle.status | release | | | org.gradle.category | library | library | | org.gradle.libraryelements | jar | classes+resources | | org.gradle.usage | java-api | java-api | | org.gradle.dependency.bundling | | external | | org.gradle.jvm.environment | | standard-jvm | | org.gradle.jvm.version | | 17 | | org.jetbrains.kotlin.platform.type | | jvm | io.vavr:vavr:0.10.2 \--- io.github.resilience4j:resilience4j-vavr:2.0.2 +--- compileClasspath (requested io.github.resilience4j:resilience4j-vavr) \--- io.spinnaker.kork:kork-bom:sb-3-0-13-2-SNAPSHOT \--- compileClasspath ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Upgrading spring boot 2.7.18 to 3.0.13 and spring cloud 2021.0.8 to 2022.0.5. Spring cloud release 2022.0.x is compatible with spring boot 3.0.x. https://github.com/spring-cloud/spring-cloud-release/wiki/Supported-Versions#supported-releases ======================================================
refactor(dependency): replace javax with jakarta during upgrade of spring boot 3.0.x
Spring Boot 3.0 has migrated from Java EE to Jakarta EE APIs for all dependencies. https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Release-Notes#third-party-library-upgrades So, replacing the imports with
javax
tojakarta
.