Skip to content

Commit d4f86bd

Browse files
committed
Migrate to Spring 7 / Spring Boot 4
1 parent 583538d commit d4f86bd

File tree

42 files changed

+174
-143
lines changed

Some content is hidden

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

42 files changed

+174
-143
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ well, where all services code is in Spring.
5252

5353
### Requirements
5454

55-
* Spring 5+, 6+
55+
* Spring 5+, 6+, 7+
5656
* Java 1.8+,17
57-
* Spring boot 2+,3+
57+
* Spring boot 2+,3+,4+
5858
* Lettuce client for Redis cluster
5959
* Read master preference for Redis cluster
6060

@@ -98,6 +98,7 @@ from [Maven central](https://search.maven.org/search?q=g:com.github.sonus21%20AN
9898
9999
* For spring framework 5.x use rqueue-spring 2.x
100100
* For spring framework 6.x use rqueue-spring 3.x
101+
* For spring framework 7.x use rqueue-spring 4.x
101102
102103
Get the latest one
103104
from [Maven central](https://search.maven.org/search?q=g:com.github.sonus21%20AND%20a:rqueue-spring)

build.gradle

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
plugins {
22
id "jacoco"
33
id 'com.github.kt3k.coveralls' version '2.12.2'
4-
id "com.adarshr.test-logger" version "3.2.0"
5-
id "org.gradle.test-retry" version "1.5.0"
4+
id "com.adarshr.test-logger" version "4.0.0"
5+
id "org.gradle.test-retry" version "1.6.4"
66
}
77

88
allprojects {
@@ -12,8 +12,10 @@ allprojects {
1212
apply plugin: "com.adarshr.test-logger"
1313
apply plugin: "org.gradle.test-retry"
1414

15-
sourceCompatibility = 17
16-
targetCompatibility = 17
15+
java {
16+
sourceCompatibility = "17"
17+
targetCompatibility = "17"
18+
}
1719

1820
repositories {
1921
mavenCentral()
@@ -22,15 +24,15 @@ allprojects {
2224
}
2325

2426
ext {
25-
springBootVersion = "3.0.1"
26-
springVersion = "6.0.3"
27-
springDataVersion = "3.0.0"
28-
microMeterVersion = "1.10.2"
27+
springBootVersion = "4.0.1"
28+
springVersion = "7.0.3"
29+
springDataVersion = "4.0.2"
30+
microMeterVersion = "1.16.2"
2931

3032
// logging dependencies
31-
lombokVersion = "1.18.30"
32-
logbackVersion = "1.4.5"
33-
sl4jVersion = "2.0.6"
33+
lombokVersion = "1.18.42"
34+
logbackVersion = "1.5.25"
35+
sl4jVersion = "2.0.17"
3436

3537
// testing
3638
jupiterVersion = "5.5.0"
@@ -42,34 +44,35 @@ ext {
4244
tomcatVersion = "10.1.4"
4345

4446
// utility
45-
lang3Version = "3.9"
46-
jacksonVersion = "2.14.1"
47+
lang3Version = "3.20.0"
48+
jacksonVersion = "3.0.3"
49+
jacksonAnnotationsVersion = "2.21"
4750

4851
// server
49-
jakartaServletVersion = "6.0.0"
50-
pebbleVersion = "3.2.2"
52+
jakartaServletVersion = "6.1.0"
53+
pebbleVersion = "4.1.0"
5154

5255
// database
53-
lettuceVersion = "6.2.2.RELEASE"
54-
jakartaAnnotationVersion = "2.1.0"
55-
jakartaPersistenceVersion = "3.1.0"
56-
hibernateCoreVersion = "5.6.14.Final"
56+
lettuceVersion = "7.2.1.RELEASE"
57+
jakartaAnnotationVersion = "3.0.0"
58+
jakartaPersistenceVersion = "3.2.0"
59+
hibernateCoreVersion = "7.2.1.Final"
5760

5861
// other dependencies
59-
jakartaValidationApiVersion = "3.0.2"
62+
jakartaValidationApiVersion = "3.1.1"
6063
serucoEncodingVersion = "0.1.3"
61-
apacheCommonCollectionVerion = "4.4"
62-
hibernateValidatorVersion = "7.0.5.Final"
63-
springDepManagementVersion = "1.1.0"
64-
projectReactorReactorTestVersion = "3.5.1"
65-
aspectjVersion = "1.9.19"
66-
guavaVersion = "32.1.1-jre"
64+
apacheCommonCollectionVerion = "4.5.0"
65+
hibernateValidatorVersion = "9.1.0.Final"
66+
springDepManagementVersion = "1.1.7"
67+
projectReactorReactorTestVersion = "3.8.2"
68+
aspectjVersion = "1.9.25.1"
69+
guavaVersion = "33.5.0-jre"
6770
}
6871

6972

7073
subprojects {
7174
group = "com.github.sonus21"
72-
version = "3.4.0-RELEASE"
75+
version = "4.0.0-RELEASE"
7376

7477
dependencies {
7578
// https://mvnrepository.com/artifact/org.springframework/spring-messaging
@@ -94,6 +97,7 @@ subprojects {
9497
// https://mvnrepository.com/artifact/ch.qos.logback/logback-classic
9598
testImplementation "ch.qos.logback:logback-classic:${logbackVersion}"
9699
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:${jupiterVersion}"
100+
testRuntimeOnly "org.junit.platform:junit-platform-launcher:6.0.2"
97101
testImplementation "org.junit.jupiter:junit-jupiter-api:${jupiterVersion}"
98102
testImplementation "org.junit.jupiter:junit-jupiter-params:${jupiterVersion}"
99103
// https://mvnrepository.com/artifact/org.mockito/mockito-inline

docs/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ frameworks.
5252

5353
### Requirements
5454

55-
* Spring 5+, 6+
56-
* Spring Boot 2+, 3+
55+
* Spring 5+, 6+, 7+
56+
* Spring Boot 2+, 3+, 4+
5757
* Spring Reactive
5858
* Lettuce client for Redis cluster
5959
* Read master preference for Redis cluster
@@ -82,8 +82,8 @@ Redis cluster compatibility, otherwise the application may fail to start.
8282
### Spring Boot
8383

8484
{: .warning }
85-
Use Rqueue Spring Boot Starter 3.x for Spring Boot 3.x, and Rqueue Spring Boot Starter 2.x for
86-
Spring Boot 2.x.
85+
Use Rqueue Spring Boot Starter 4.x for Spring Boot 4.x, Rqueue Spring Boot Starter 3.x for
86+
Spring Boot 3.x, and Rqueue Spring Boot Starter 2.x for Spring Boot 2.x.
8787

8888
Get the latest version of Rqueue Spring Boot Starter from [Maven Central][Boot Maven Central]. Add
8989
the dependency to your project:
@@ -125,7 +125,8 @@ the dependency to your project:
125125
### Spring Framework
126126

127127
{: .warning }
128-
Use Rqueue Spring 3.x for Spring Framework 6.x, and Rqueue Spring 2.x for Spring Framework 5.x.
128+
Use Rqueue Spring 4.x for Spring Framework 7.x, Rqueue Spring 3.x for Spring Framework 6.x,
129+
and Rqueue Spring 2.x for Spring Framework 5.x.
129130

130131
Get the latest version of Rqueue Spring from [Maven Central][Maven Central]. Add the dependency to
131132
your project:

gradle/wrapper/gradle-wrapper.jar

-17.7 KB
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
44
networkTimeout=10000
5+
validateDistributionUrl=true
56
zipStoreBase=GRADLE_USER_HOME
67
zipStorePath=wrapper/dists

gradlew

Lines changed: 17 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rqueue-core/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ mavenPublishing {
4141

4242
dependencies {
4343
// https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
44-
api "com.fasterxml.jackson.core:jackson-core:${jacksonVersion}"
45-
api "com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}"
46-
api "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}"
44+
api "tools.jackson.core:jackson-core:${jacksonVersion}"
45+
api "tools.jackson.core:jackson-databind:${jacksonVersion}"
46+
api "com.fasterxml.jackson.core:jackson-annotations:${jacksonAnnotationsVersion}"
4747
// https://mvnrepository.com/artifact/jakarta.servlet/jakarta.servlet-api
4848
api "jakarta.servlet:jakarta.servlet-api:${jakartaServletVersion}"
4949
// https://mvnrepository.com/artifact/jakarta.validation/jakarta.validation-api
5050
api "jakarta.validation:jakarta.validation-api:${jakartaValidationApiVersion}"
51+
implementation 'jakarta.el:jakarta.el-api:5.0.0'
52+
runtimeOnly 'org.glassfish:jakarta.el:4.0.2'
5153
// https://mvnrepository.com/artifact/org.springframework/spring-webmvc
5254
api "org.springframework:spring-webmvc:${springVersion}"
5355
api "org.springframework:spring-webflux:${springVersion}"

rqueue-core/src/main/java/com/github/sonus21/rqueue/converter/GenericMessageConverter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@
1818

1919
import static org.springframework.util.Assert.notNull;
2020

21-
import com.fasterxml.jackson.core.JsonProcessingException;
22-
import com.fasterxml.jackson.databind.JavaType;
23-
import com.fasterxml.jackson.databind.ObjectMapper;
2421
import com.github.sonus21.rqueue.utils.SerializationUtils;
2522
import java.lang.reflect.TypeVariable;
2623
import java.util.Collection;
@@ -34,6 +31,9 @@
3431
import org.springframework.messaging.MessageHeaders;
3532
import org.springframework.messaging.converter.SmartMessageConverter;
3633
import org.springframework.messaging.support.GenericMessage;
34+
import tools.jackson.core.JacksonException;
35+
import tools.jackson.databind.JavaType;
36+
import tools.jackson.databind.ObjectMapper;
3737

3838
/**
3939
* A converter to turn the payload of a {@link Message} from serialized form to a typed String and
@@ -212,7 +212,7 @@ public String serialize(Object payload) {
212212
String msg = objectMapper.writeValueAsString(payload);
213213
Msg message = new Msg(msg, name);
214214
return objectMapper.writeValueAsString(message);
215-
} catch (JsonProcessingException e) {
215+
} catch (JacksonException e) {
216216
log.debug("Serialisation failed", e);
217217
return null;
218218
}

rqueue-core/src/main/java/com/github/sonus21/rqueue/converter/JsonMessageConverter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
import static org.springframework.util.Assert.notNull;
2020

21-
import com.fasterxml.jackson.core.JsonProcessingException;
22-
import com.fasterxml.jackson.databind.ObjectMapper;
2321
import com.github.sonus21.rqueue.utils.SerializationUtils;
2422
import lombok.extern.slf4j.Slf4j;
2523
import org.springframework.messaging.Message;
2624
import org.springframework.messaging.MessageHeaders;
27-
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
25+
import org.springframework.messaging.converter.JacksonJsonMessageConverter;
2826
import org.springframework.messaging.converter.MessageConverter;
2927
import org.springframework.messaging.support.GenericMessage;
28+
import tools.jackson.core.JacksonException;
29+
import tools.jackson.databind.ObjectMapper;
3030

3131
/**
3232
* JsonMessageConverter tries to convert to JSON and from JSON to object.
@@ -37,7 +37,7 @@
3737
* <p>Target class is null till the time method arguments are not resolved, once method arguments
3838
* are resolved then it will become non-null.
3939
*
40-
* @see MappingJackson2MessageConverter
40+
* @see JacksonJsonMessageConverter
4141
*/
4242
@Slf4j
4343
public class JsonMessageConverter implements MessageConverter {
@@ -65,7 +65,7 @@ public Object fromMessage(Message<?> message, Class<?> targetClass) {
6565
return objectMapper.readValue(payload, targetClass);
6666
}
6767
return null;
68-
} catch (JsonProcessingException | ClassCastException e) {
68+
} catch (JacksonException | ClassCastException e) {
6969
log.debug("Deserialization of message {} failed", message, e);
7070
return null;
7171
}
@@ -77,7 +77,7 @@ public Message<?> toMessage(Object payload, MessageHeaders headers) {
7777
try {
7878
String msg = objectMapper.writeValueAsString(payload);
7979
return new GenericMessage<>(msg);
80-
} catch (JsonProcessingException e) {
80+
} catch (JacksonException e) {
8181
log.debug("Serialisation failed, Payload: {}", payload, e);
8282
return null;
8383
}

rqueue-core/src/main/java/com/github/sonus21/rqueue/converter/RqueueRedisSerializer.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
package com.github.sonus21.rqueue.converter;
1818

1919
import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
20-
import com.fasterxml.jackson.core.JsonGenerator;
21-
import com.fasterxml.jackson.core.JsonProcessingException;
22-
import com.fasterxml.jackson.databind.ObjectMapper;
23-
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
24-
import com.fasterxml.jackson.databind.SerializerProvider;
25-
import com.fasterxml.jackson.databind.module.SimpleModule;
26-
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
2720
import com.github.sonus21.rqueue.utils.SerializationUtils;
28-
import java.io.IOException;
2921
import lombok.extern.slf4j.Slf4j;
3022
import org.springframework.cache.support.NullValue;
3123
import org.springframework.data.redis.serializer.RedisSerializer;
3224
import org.springframework.data.redis.serializer.SerializationException;
25+
import tools.jackson.core.JacksonException;
26+
import tools.jackson.core.JsonGenerator;
27+
import tools.jackson.databind.DefaultTyping;
28+
import tools.jackson.databind.ObjectMapper;
29+
import tools.jackson.databind.SerializationContext;
30+
import tools.jackson.databind.jsontype.BasicPolymorphicTypeValidator;
31+
import tools.jackson.databind.module.SimpleModule;
32+
import tools.jackson.databind.ser.std.StdSerializer;
3333

3434
@Slf4j
3535
public class RqueueRedisSerializer implements RedisSerializer<Object> {
@@ -68,10 +68,12 @@ private static class RqueueRedisSerDes implements RedisSerializer<Object> {
6868
private ObjectMapper mapper;
6969

7070
RqueueRedisSerDes() {
71-
this.mapper = SerializationUtils.createObjectMapper();
72-
this.mapper =
73-
mapper.registerModule(new SimpleModule().addSerializer(new NullValueSerializer()));
74-
this.mapper = mapper.enableDefaultTyping(DefaultTyping.NON_FINAL, As.PROPERTY);
71+
this.mapper = SerializationUtils.createObjectMapper().rebuild()
72+
.addModule(new SimpleModule().addSerializer(new NullValueSerializer()))
73+
.activateDefaultTyping(BasicPolymorphicTypeValidator.builder()
74+
.allowIfSubType(Object.class)
75+
.build(), DefaultTyping.NON_FINAL, As.PROPERTY)
76+
.build();
7577
}
7678

7779
@Override
@@ -81,7 +83,7 @@ public byte[] serialize(Object source) throws SerializationException {
8183
}
8284
try {
8385
return mapper.writeValueAsBytes(source);
84-
} catch (JsonProcessingException e) {
86+
} catch (JacksonException e) {
8587
throw new SerializationException("Could not write JSON: " + e.getMessage(), e);
8688
}
8789
}
@@ -109,11 +111,9 @@ private static class NullValueSerializer extends StdSerializer<NullValue> {
109111
}
110112

111113
@Override
112-
public void serialize(
113-
NullValue value, JsonGenerator jsonGenerator, SerializerProvider provider)
114-
throws IOException {
114+
public void serialize(NullValue value, JsonGenerator jsonGenerator, SerializationContext provider) throws JacksonException {
115115
jsonGenerator.writeStartObject();
116-
jsonGenerator.writeStringField(classIdentifier, NullValue.class.getName());
116+
jsonGenerator.writeStringProperty(classIdentifier, NullValue.class.getName());
117117
jsonGenerator.writeEndObject();
118118
}
119119
}

0 commit comments

Comments
 (0)