Skip to content

Commit 43e3fae

Browse files
committed
fix(kotlin-spring): replace legacy oauth2 starter and add Jackson exclusivity tests
Replace deprecated spring-cloud-starter-oauth2:2.2.5.RELEASE with spring-boot-starter-oauth2-client in SB4 templates, as the legacy starter is pre-Jakarta and incompatible with Spring Boot 4. Add negative assertions to Jackson dependency tests to ensure Jackson 2 and Jackson 3 artifacts are mutually exclusive.
1 parent 028f360 commit 43e3fae

5 files changed

Lines changed: 10 additions & 12 deletions

File tree

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/buildGradle-sb4-Kts.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dependencies {
6666
{{/useJackson3}}
6767

6868
implementation("org.springframework.cloud:spring-cloud-starter-openfeign"){{#hasAuthMethods}}
69-
implementation("org.springframework.cloud:spring-cloud-starter-oauth2:2.2.5.RELEASE"){{/hasAuthMethods}}
69+
implementation("org.springframework.boot:spring-boot-starter-oauth2-client"){{/hasAuthMethods}}
7070

7171
{{#useBeanValidation}}
7272
implementation("jakarta.validation:jakarta.validation-api"){{/useBeanValidation}}

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-cloud/pom-sb4.mustache

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,8 @@
179179
</dependency>
180180
{{#hasAuthMethods}}
181181
<dependency>
182-
<groupId>org.springframework.cloud</groupId>
183-
<artifactId>spring-cloud-starter-oauth2</artifactId>
184-
{{^parentOverridden}}
185-
<version>2.2.5.RELEASE</version>
186-
{{/parentOverridden}}
182+
<groupId>org.springframework.boot</groupId>
183+
<artifactId>spring-boot-starter-oauth2-client</artifactId>
187184
</dependency>
188185
{{/hasAuthMethods}}
189186
<dependency>

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/buildGradle-sb4-Kts.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ dependencies {
6666
{{/useJackson3}}
6767

6868
{{#hasAuthMethods}}
69-
implementation("org.springframework.cloud:spring-cloud-starter-oauth2:2.2.5.RELEASE"){{/hasAuthMethods}}
69+
implementation("org.springframework.boot:spring-boot-starter-oauth2-client"){{/hasAuthMethods}}
7070

7171
{{#useBeanValidation}}
7272
implementation("jakarta.validation:jakarta.validation-api"){{/useBeanValidation}}

modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-declarative-http-interface/pom-sb4.mustache

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,8 @@
175175
</dependency>
176176
{{#hasAuthMethods}}
177177
<dependency>
178-
<groupId>org.springframework.cloud</groupId>
179-
<artifactId>spring-cloud-starter-oauth2</artifactId>
180-
{{^parentOverridden}}
181-
<version>2.2.5.RELEASE</version>
182-
{{/parentOverridden}}
178+
<groupId>org.springframework.boot</groupId>
179+
<artifactId>spring-boot-starter-oauth2-client</artifactId>
183180
</dependency>
184181
{{/hasAuthMethods}}
185182
<dependency>

modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4868,6 +4868,8 @@ public void shouldGenerateSpringBoot4PomWithJackson3Deps() throws IOException {
48684868
assertFileContains(pomPath, "tools.jackson.dataformat");
48694869
assertFileContains(pomPath, "tools.jackson.module");
48704870
assertFileNotContains(pomPath, "jackson-datatype-jsr310");
4871+
assertFileNotContains(pomPath, "com.fasterxml.jackson.dataformat");
4872+
assertFileNotContains(pomPath, "com.fasterxml.jackson.module");
48714873
}
48724874

48734875
@Test
@@ -4898,6 +4900,8 @@ public void shouldGenerateSpringBoot4PomWithJackson2Deps() throws IOException {
48984900
assertFileContains(pomPath, "4.0.1");
48994901
assertFileContains(pomPath, "com.fasterxml.jackson.dataformat");
49004902
assertFileContains(pomPath, "jackson-datatype-jsr310");
4903+
assertFileNotContains(pomPath, "tools.jackson.dataformat");
4904+
assertFileNotContains(pomPath, "tools.jackson.module");
49014905
}
49024906
}
49034907

0 commit comments

Comments
 (0)