Skip to content

Commit c5e87eb

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 a90a576 commit c5e87eb

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
@@ -4839,6 +4839,8 @@ public void shouldGenerateSpringBoot4PomWithJackson3Deps() throws IOException {
48394839
assertFileContains(pomPath, "tools.jackson.dataformat");
48404840
assertFileContains(pomPath, "tools.jackson.module");
48414841
assertFileNotContains(pomPath, "jackson-datatype-jsr310");
4842+
assertFileNotContains(pomPath, "com.fasterxml.jackson.dataformat");
4843+
assertFileNotContains(pomPath, "com.fasterxml.jackson.module");
48424844
}
48434845

48444846
@Test
@@ -4869,6 +4871,8 @@ public void shouldGenerateSpringBoot4PomWithJackson2Deps() throws IOException {
48694871
assertFileContains(pomPath, "4.0.1");
48704872
assertFileContains(pomPath, "com.fasterxml.jackson.dataformat");
48714873
assertFileContains(pomPath, "jackson-datatype-jsr310");
4874+
assertFileNotContains(pomPath, "tools.jackson.dataformat");
4875+
assertFileNotContains(pomPath, "tools.jackson.module");
48724876
}
48734877
}
48744878

0 commit comments

Comments
 (0)