Skip to content

Commit e73de35

Browse files
authored
Chore/migrate to spring boot 4 (#1550)
* chore: migrate to spring boot 4 (wip) * chore: migrate to spring boot 4 (wip) - back to jackson 2 * chore: upgrade libraries to spring boot 4 sqs is not supported yet. requires update to io-awspring-cloud * chore: cleanup * chore: update library version management * chore: update dependencies * chore(sqs): disable plugin while no update is available * chore(jms): update broker configuration * fix(core): fix MessageDto after rebase * fix(core): fix HeaderValueSerializer * chore: resolve deprecations for org.springframework.lang.Nullable * chore: resolve deprecations for jspecify
1 parent 7ee8d46 commit e73de35

File tree

119 files changed

+580
-578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+580
-578
lines changed

.github/workflows/springwolf-plugins.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
fail-fast: false
2727
matrix:
28-
plugin: [ "amqp", "cloud-stream", "jms", "kafka", "sns", "sqs", "stomp" ]
28+
plugin: [ "amqp", "cloud-stream", "jms", "kafka", "sns", "stomp" ] # "sqs" , re-enable, when update available: https://github.com/awspring/spring-cloud-aws/milestone/42
2929

3030
env:
3131
plugin: springwolf-plugins/springwolf-${{ matrix.plugin }}-plugin

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ var plugins = [
3232
'springwolf-jms',
3333
'springwolf-kafka',
3434
'springwolf-sns',
35-
'springwolf-sqs',
35+
// 'springwolf-sqs', re-enable, when update available: https://github.com/awspring/spring-cloud-aws/milestone/42
3636
'springwolf-stomp'
3737
]
3838

@@ -106,7 +106,7 @@ allprojects {
106106

107107
useJUnitPlatform()
108108
testLogging {
109-
showStandardStreams = true
109+
// showStandardStreams = true
110110

111111
events "skipped", "failed"
112112
exceptionFormat = 'full'

gradle/libs.versions.toml

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,29 +21,35 @@ owasp-dependencycheck = "12.1.9"
2121
protobuf = "4.33.1"
2222
protobuf-plugin = "0.9.5"
2323
spotless = "8.0.0"
24-
spring-boot-plugin = "3.5.7"
24+
spring-boot-plugin = "4.0.0"
2525
spring-cloud = "2025.1.0" # not managed by spring-boot-dependencies
26-
spring-cloud-stream = "4.3.0" # not managed by spring-boot-dependencies
26+
spring-cloud-stream = "5.0.0" # not managed by spring-boot-dependencies
2727

2828
[libraries]
2929
activemq-broker = { module = "org.apache.activemq:activemq-broker", version.ref = "activemq" }
3030
amqp-client = "com.rabbitmq:amqp-client:5.27.1"
3131
assertj-core = "org.assertj:assertj-core:3.27.6"
3232
avro = "org.apache.avro:avro:1.12.1"
3333
awaitility = "org.awaitility:awaitility:4.3.0"
34+
commons-io = "commons-io:commons-io:2.20.0"
3435
commons-lang3 = "org.apache.commons:commons-lang3:3.20.0"
36+
commons-logging = "commons-logging:commons-logging:1.3.5"
3537
jackson-annotations = "com.fasterxml.jackson.core:jackson-annotations:2.20"
3638
jackson-core = { module = "com.fasterxml.jackson.core:jackson-core", version.ref = "jackson-core" }
3739
jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jackson-core" }
3840
jackson-dataformat-yaml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml", version.ref = "jackson-core" }
3941
jackson-datatype-protobuf = "com.hubspot.jackson:jackson-datatype-protobuf:0.9.18"
4042
jakarta-annotation-api = "jakarta.annotation:jakarta.annotation-api:3.0.0"
4143
jakarta-jms-api = "jakarta.jms:jakarta.jms-api:3.1.0"
44+
jakarta-servlet-api = "jakarta.servlet:jakarta.servlet-api:6.1.0"
4245
jakarta-validation-api = "jakarta.validation:jakarta.validation-api:3.1.1"
46+
jakarta-websocket-api = "jakarta.websocket:jakarta.websocket-api:2.2.0"
47+
jakarta-websocket-client-api = "jakarta.websocket:jakarta.websocket-client-api:2.2.0"
4348
jakarta-xml-bind-api = "jakarta.xml.bind:jakarta.xml.bind-api:4.0.4"
4449
jetbrains-annotations = "org.jetbrains:annotations:26.0.2"
4550
json-schema-validator = "com.networknt:json-schema-validator:1.5.9"
4651
json-unit-assertj = "net.javacrumbs.json-unit:json-unit-assertj:5.1.0"
52+
jspecify = "org.jspecify:jspecify:1.0.0"
4753
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "org-junit-jupiter" }
4854
junit-plattform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "org-junit-plattform" }
4955
junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "org-junit-jupiter" }
@@ -70,27 +76,30 @@ spring-cloud-aws-starter-sqs = { module = "io.awspring.cloud:spring-cloud-aws-st
7076
spring-amqp = { module = "org.springframework.amqp:spring-amqp" }
7177
spring-rabbit = { module = "org.springframework.amqp:spring-rabbit" }
7278
spring-boot = { module = "org.springframework.boot:spring-boot" }
73-
spring-boot-actuator = { module = "org.springframework.boot:spring-boot-actuator" }
79+
spring-boot-artemis = { module = "org.springframework.boot:spring-boot-artemis" }
7480
spring-boot-autoconfigure = { module = "org.springframework.boot:spring-boot-autoconfigure" }
7581
spring-boot-configuration-processor = { module = "org.springframework.boot:spring-boot-configuration-processor" }
82+
spring-boot-jackson2 = { module = "org.springframework.boot:spring-boot-jackson2", version.ref = "spring-boot-plugin" }
83+
spring-boot-jms = { module = "org.springframework.boot:spring-boot-jms" }
84+
spring-boot-kafka = { module = "org.springframework.boot:spring-boot-kafka" }
85+
spring-boot-restclient-test = { module = "org.springframework.boot:spring-boot-resttestclient" }
7686
spring-boot-starter-actuator = { module = "org.springframework.boot:spring-boot-starter-actuator" }
77-
spring-boot-starter-artemis = { module = "org.springframework.boot:spring-boot-starter-artemis" }
78-
spring-boot-starter-web = { module = "org.springframework.boot:spring-boot-starter-web" }
79-
spring-boot-starter-websocket = { module = "org.springframework.boot:spring-boot-starter-websocket" }
87+
spring-boot-starter-amqp = { module = "org.springframework.boot:spring-boot-starter-amqp" }
88+
spring-boot-starter-webmvc = { module = "org.springframework.boot:spring-boot-starter-webmvc" }
8089
spring-boot-test = { module = "org.springframework.boot:spring-boot-test" }
81-
spring-boot-test-autoconfigure = { module = "org.springframework.boot:spring-boot-test-autoconfigure" }
90+
spring-boot-webmvc = { module = "org.springframework.boot:spring-boot-webmvc" }
91+
spring-boot-webmvc-test = { module = "org.springframework.boot:spring-boot-webmvc-test" }
8292
spring-cloud-dependencies = { module = "org.springframework.cloud:spring-cloud-dependencies", version.ref = "spring-cloud" }
8393
spring-cloud-starter-stream-kafka = { module = "org.springframework.cloud:spring-cloud-starter-stream-kafka", version.ref = "spring-cloud-stream" }
8494
spring-cloud-stream = { module = "org.springframework.cloud:spring-cloud-stream", version.ref = "spring-cloud-stream" }
85-
spring-kafka = { module = "org.springframework.kafka:spring-kafka" }
86-
spring-kafka-test = { module = "org.springframework.kafka:spring-kafka-test" }
8795
spring-security-config = { module = "org.springframework.security:spring-security-config" }
8896
spring-security-web = { module = "org.springframework.security:spring-security-web" }
8997
spring-beans = { module = "org.springframework:spring-beans" }
9098
spring-context = { module = "org.springframework:spring-context" }
9199
spring-core = { module = "org.springframework:spring-core" }
92-
spring-jcl = { module = "org.springframework:spring-jcl" }
93100
spring-jms = { module = "org.springframework:spring-jms" }
101+
spring-kafka = { module = "org.springframework.kafka:spring-kafka" }
102+
spring-kafka-test = { module = "org.springframework.kafka:spring-kafka-test" }
94103
spring-messaging = { module = "org.springframework:spring-messaging" }
95104
spring-test = { module = "org.springframework:spring-test" }
96105
spring-web = { module = "org.springframework:spring-web" }

settings.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ include(
88
'springwolf-plugins:springwolf-jms-plugin',
99
'springwolf-plugins:springwolf-kafka-plugin',
1010
'springwolf-plugins:springwolf-sns-plugin',
11-
'springwolf-plugins:springwolf-sqs-plugin',
11+
// 'springwolf-plugins:springwolf-sqs-plugin', re-enable, when update available: https://github.com/awspring/spring-cloud-aws/milestone/42
1212
'springwolf-plugins:springwolf-stomp-plugin',
1313
'springwolf-examples:e2e',
1414
'springwolf-examples:springwolf-amqp-example',
1515
'springwolf-examples:springwolf-cloud-stream-example',
1616
'springwolf-examples:springwolf-jms-example',
1717
'springwolf-examples:springwolf-kafka-example',
1818
'springwolf-examples:springwolf-sns-example',
19-
'springwolf-examples:springwolf-sqs-example',
19+
// 'springwolf-examples:springwolf-sqs-example', re-enable, when update available: https://github.com/awspring/spring-cloud-aws/milestone/42
2020
'springwolf-examples:springwolf-stomp-example',
2121
'springwolf-bindings:springwolf-amqp-binding',
2222
'springwolf-bindings:springwolf-googlepubsub-binding',
@@ -37,6 +37,6 @@ project(':springwolf-plugins:springwolf-cloud-stream-plugin').name = 'springwolf
3737
project(':springwolf-plugins:springwolf-jms-plugin').name = 'springwolf-jms'
3838
project(':springwolf-plugins:springwolf-kafka-plugin').name = 'springwolf-kafka'
3939
project(':springwolf-plugins:springwolf-sns-plugin').name = 'springwolf-sns'
40-
project(':springwolf-plugins:springwolf-sqs-plugin').name = 'springwolf-sqs'
40+
//project(':springwolf-plugins:springwolf-sqs-plugin').name = 'springwolf-sqs', re-enable, when update available: https://github.com/awspring/spring-cloud-aws/milestone/42
4141
project(':springwolf-plugins:springwolf-stomp-plugin').name = 'springwolf-stomp'
4242

springwolf-add-ons/springwolf-json-schema/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ dependencies {
1111
api project(":springwolf-core")
1212
api project(":springwolf-asyncapi")
1313

14+
implementation libs.jakarta.annotation.api
15+
1416
implementation libs.jackson.core
1517
implementation libs.jackson.databind
16-
implementation libs.spring.core
1718

18-
testImplementation libs.swagger.core.jakarta
1919
testImplementation libs.swagger.models.jakarta
2020

2121
implementation libs.slf4j.api

springwolf-add-ons/springwolf-json-schema/src/main/java/io/github/springwolf/addons/json_schema/JsonSchemaGenerator.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package io.github.springwolf.addons.json_schema;
33

4-
import com.fasterxml.jackson.core.JsonProcessingException;
4+
import com.fasterxml.jackson.core.JacksonException;
55
import com.fasterxml.jackson.databind.JsonNode;
66
import com.fasterxml.jackson.databind.ObjectMapper;
7+
import com.fasterxml.jackson.databind.json.JsonMapper;
78
import com.fasterxml.jackson.databind.node.ArrayNode;
89
import com.fasterxml.jackson.databind.node.ObjectNode;
910
import io.github.springwolf.asyncapi.v3.model.ReferenceUtil;
1011
import io.github.springwolf.asyncapi.v3.model.components.ComponentSchema;
1112
import io.github.springwolf.asyncapi.v3.model.schema.MultiFormatSchema;
1213
import io.github.springwolf.asyncapi.v3.model.schema.SchemaObject;
1314
import io.github.springwolf.asyncapi.v3.model.schema.SchemaReference;
15+
import jakarta.annotation.Nullable;
1416
import lombok.RequiredArgsConstructor;
15-
import org.springframework.lang.Nullable;
1617

1718
import java.util.HashSet;
1819
import java.util.Map;
1920
import java.util.Set;
2021

2122
@RequiredArgsConstructor
2223
public class JsonSchemaGenerator {
23-
private static final ObjectMapper objectMapper = new ObjectMapper();
24+
private static final ObjectMapper jsonMapper = JsonMapper.builder().build();
2425

25-
public Object fromSchema(ComponentSchema schema, Map<String, ComponentSchema> definitions)
26-
throws JsonProcessingException {
26+
public Object fromSchema(ComponentSchema schema, Map<String, ComponentSchema> definitions) throws JacksonException {
2727
ObjectNode node = fromSchemaInternal(schema, definitions, new HashSet<>());
2828
node.put("$schema", "https://json-schema.org/draft-04/schema#");
2929

30-
return objectMapper.readValue(node.toString(), Object.class);
30+
return jsonMapper.readValue(node.toString(), Object.class);
3131
}
3232

3333
private ObjectNode fromSchemaInternal(
@@ -37,28 +37,28 @@ private ObjectNode fromSchemaInternal(
3737

3838
return mapToJsonSchema(schema, definitions, visited);
3939
}
40-
return objectMapper.createObjectNode();
40+
return jsonMapper.createObjectNode();
4141
}
4242

4343
private ObjectNode mapToJsonSchema(
4444
ComponentSchema componentSchema, Map<String, ComponentSchema> definitions, Set<ComponentSchema> visited) {
45-
ObjectNode node = objectMapper.createObjectNode();
45+
ObjectNode node = jsonMapper.createObjectNode();
4646

4747
SchemaObject schema = getSchemaObject(componentSchema, definitions);
4848
if (schema == null) {
4949
return node;
5050
}
5151

5252
if (schema.getAnyOf() != null) {
53-
ArrayNode arrayNode = objectMapper.createArrayNode();
53+
ArrayNode arrayNode = jsonMapper.createArrayNode();
5454
for (ComponentSchema ofSchema : schema.getAnyOf()) {
5555
ComponentSchema resolvedSchemaObject = resolveSchemaRef(ofSchema, definitions);
5656
arrayNode.add(fromSchemaInternal(resolvedSchemaObject, definitions, visited));
5757
}
5858
node.set("anyOf", arrayNode);
5959
}
6060
if (schema.getAllOf() != null) {
61-
ArrayNode arrayNode = objectMapper.createArrayNode();
61+
ArrayNode arrayNode = jsonMapper.createArrayNode();
6262
for (ComponentSchema allSchema : schema.getAllOf()) {
6363
ComponentSchema resolvedSchemaObject = resolveSchemaRef(allSchema, definitions);
6464
arrayNode.add(fromSchemaInternal(resolvedSchemaObject, definitions, visited));
@@ -72,7 +72,7 @@ private ObjectNode mapToJsonSchema(
7272
node.put("description", schema.getDescription());
7373
}
7474
if (schema.getEnumValues() != null) {
75-
ArrayNode arrayNode = objectMapper.createArrayNode();
75+
ArrayNode arrayNode = jsonMapper.createArrayNode();
7676
for (Object property : schema.getEnumValues()) {
7777
arrayNode.add(property == null ? null : property.toString());
7878
}
@@ -117,7 +117,7 @@ private ObjectNode mapToJsonSchema(
117117
node.set("not", fromSchemaInternal(resolvedSchemaObject, definitions, visited));
118118
}
119119
if (schema.getOneOf() != null) {
120-
ArrayNode arrayNode = objectMapper.createArrayNode();
120+
ArrayNode arrayNode = jsonMapper.createArrayNode();
121121
for (ComponentSchema ofSchema : schema.getOneOf()) {
122122
ComponentSchema resolvedSchemaObject = resolveSchemaRef(ofSchema, definitions);
123123
arrayNode.add(fromSchemaInternal(resolvedSchemaObject, definitions, visited));
@@ -131,7 +131,7 @@ private ObjectNode mapToJsonSchema(
131131
node.set("properties", buildProperties(schema, definitions, visited));
132132
}
133133
if (schema.getRequired() != null) {
134-
ArrayNode arrayNode = objectMapper.createArrayNode();
134+
ArrayNode arrayNode = jsonMapper.createArrayNode();
135135
for (String property : schema.getRequired()) {
136136
arrayNode.add(property);
137137
}
@@ -144,7 +144,7 @@ private ObjectNode mapToJsonSchema(
144144
if (schema.getType().size() == 1) {
145145
node.put("type", schema.getType().iterator().next());
146146
} else if (schema.getType().size() > 1) {
147-
ArrayNode arrayNode = objectMapper.createArrayNode();
147+
ArrayNode arrayNode = jsonMapper.createArrayNode();
148148
schema.getType().forEach(arrayNode::add);
149149
node.set("type", arrayNode);
150150
}
@@ -158,7 +158,7 @@ private ObjectNode mapToJsonSchema(
158158

159159
private JsonNode buildProperties(
160160
SchemaObject schema, Map<String, ComponentSchema> definitions, Set<ComponentSchema> visited) {
161-
ObjectNode node = objectMapper.createObjectNode();
161+
ObjectNode node = jsonMapper.createObjectNode();
162162

163163
for (Map.Entry<String, Object> propertySchemaSet :
164164
schema.getProperties().entrySet()) {

springwolf-add-ons/springwolf-json-schema/src/test/java/io/github/springwolf/addons/json_schema/JsonSchemaGeneratorTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package io.github.springwolf.addons.json_schema;
33

4-
import com.fasterxml.jackson.core.JsonProcessingException;
4+
import com.fasterxml.jackson.core.JacksonException;
55
import com.fasterxml.jackson.databind.JsonNode;
6-
import com.fasterxml.jackson.databind.ObjectMapper;
6+
import com.fasterxml.jackson.databind.json.JsonMapper;
77
import com.networknt.schema.JsonSchemaFactory;
88
import com.networknt.schema.SpecVersionDetector;
99
import io.github.springwolf.asyncapi.v3.model.components.ComponentSchema;
@@ -12,7 +12,6 @@
1212
import io.github.springwolf.asyncapi.v3.model.schema.SchemaType;
1313
import io.github.springwolf.core.asyncapi.schemas.SwaggerSchemaMapper;
1414
import io.github.springwolf.core.configuration.properties.SpringwolfConfigProperties;
15-
import io.swagger.v3.core.util.Json;
1615
import io.swagger.v3.oas.models.media.ArraySchema;
1716
import io.swagger.v3.oas.models.media.BooleanSchema;
1817
import io.swagger.v3.oas.models.media.EmailSchema;
@@ -35,7 +34,7 @@
3534
import static org.assertj.core.api.Assertions.assertThat;
3635

3736
class JsonSchemaGeneratorTest {
38-
private final ObjectMapper mapper = Json.mapper();
37+
private final JsonMapper mapper = JsonMapper.builder().build();
3938
private final SwaggerSchemaMapper swaggerSchemaMapper = new SwaggerSchemaMapper(new SpringwolfConfigProperties());
4039
private final JsonSchemaGenerator jsonSchemaGenerator = new JsonSchemaGenerator();
4140

@@ -278,7 +277,9 @@ public static Stream<Arguments> validateJsonSchemaTest() {
278277
);
279278
}
280279

281-
private void verifyValidJsonSchema(String content) throws JsonProcessingException {
280+
private void verifyValidJsonSchema(String content) throws JacksonException {
281+
// not supported in jackson 3 yet: https://github.com/networknt/json-schema-validator/issues/1207
282+
282283
JsonNode jsonNode = mapper.readTree(content);
283284
JsonSchemaFactory.getInstance(SpecVersionDetector.detect(jsonNode));
284285
}

springwolf-add-ons/springwolf-kotlinx-serialization-model-converter/src/test/java/io/github/springwolf/addons/kotlinx_serialization_model_converter/converter/KotlinxSerializationTypeConverterTest.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package io.github.springwolf.addons.kotlinx_serialization_model_converter.converter;
33

4-
import com.fasterxml.jackson.core.PrettyPrinter;
5-
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
64
import com.fasterxml.jackson.databind.ObjectMapper;
75
import io.swagger.v3.core.converter.AnnotatedType;
86
import io.swagger.v3.core.converter.ModelConverters;
@@ -17,8 +15,7 @@
1715

1816
class KotlinxSerializationTypeConverterTest {
1917

20-
ObjectMapper jsonMapper = ObjectMapperFactory.createJson31();
21-
private final PrettyPrinter printer = new DefaultPrettyPrinter();
18+
private static final ObjectMapper jsonMapper = ObjectMapperFactory.createJson31();
2219

2320
private ModelConverters modelConverters;
2421

@@ -37,7 +34,8 @@ void validateGeneratedJson() throws Exception {
3734
var media = converters.readAll(new AnnotatedType(SampleEvent.class));
3835

3936
String example = ClasspathUtil.readAsString("/simple.json");
40-
assertThatJson(jsonMapper.writer(printer).writeValueAsString(media)).isEqualTo(example);
37+
assertThatJson(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(media))
38+
.isEqualTo(example);
4139
}
4240

4341
@Test
@@ -49,7 +47,8 @@ void validateGeneratedFqnJson() throws Exception {
4947
var media = converters.readAll(new AnnotatedType(SampleEvent.class));
5048

5149
String example = ClasspathUtil.readAsString("/fqn.json");
52-
assertThatJson(jsonMapper.writer(printer).writeValueAsString(media)).isEqualTo(example);
50+
assertThatJson(jsonMapper.writerWithDefaultPrettyPrinter().writeValueAsString(media))
51+
.isEqualTo(example);
5352
}
5453

5554
@Nested
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0
22
package io.github.springwolf.asyncapi.v3.jackson;
33

4-
import com.fasterxml.jackson.core.JsonProcessingException;
4+
import com.fasterxml.jackson.core.JacksonException;
55

66
public interface AsyncApiSerializerService {
77

8-
String toJsonString(Object asyncAPI) throws JsonProcessingException;
8+
String toJsonString(Object asyncAPI) throws JacksonException;
99

10-
String toYaml(Object asyncAPI) throws JsonProcessingException;
10+
String toYaml(Object asyncAPI) throws JacksonException;
1111
}

0 commit comments

Comments
 (0)