Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

## 2.2.0
- [#451](https://github.com/wultra/java-core/issues/451) - Migrated to Spring Boot 4 and Jackson 3.

6 changes: 1 addition & 5 deletions audit-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,9 @@
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
package com.wultra.core.audit.base.util;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.SerializationFeature;
import tools.jackson.databind.json.JsonMapper;
Comment thread
banterCZ marked this conversation as resolved.

import java.util.Map;

Expand All @@ -34,14 +34,11 @@ public class JsonUtil {

private static final Logger logger = LoggerFactory.getLogger(JsonUtil.class);

private final ObjectMapper objectMapper = new ObjectMapper();

{
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
objectMapper.registerModule(new JavaTimeModule());
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
}
private final ObjectMapper objectMapper = JsonMapper.builder()
.changeDefaultPropertyInclusion(incl -> incl
.withValueInclusion(JsonInclude.Include.NON_EMPTY))
.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
.build();
Comment thread
banterCZ marked this conversation as resolved.

/**
* Serialize an object into JSON.
Expand All @@ -51,7 +48,7 @@ public class JsonUtil {
public String serializeObject(Object o) {
try {
return objectMapper.writeValueAsString(o);
} catch (JsonProcessingException ex) {
} catch (JacksonException ex) {
logger.warn(ex.getMessage(), ex);
}
return "";
Expand All @@ -65,7 +62,7 @@ public String serializeObject(Object o) {
public String serializeMap(Map<String, Object> map) {
try {
return objectMapper.writeValueAsString(map);
} catch (JsonProcessingException ex) {
} catch (JacksonException ex) {
logger.warn(ex.getMessage(), ex);
}
return "{}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void testAuditScheduledCleanup() {
assertEquals(1, countAuditLogs(jdbcTemplate));

Awaitility.await()
.atMost(Duration.ofSeconds(5))
.atMost(Duration.ofSeconds(6))
.until(() -> countAuditLogs(jdbcTemplate) == 0);
}
}
Expand Down
2 changes: 1 addition & 1 deletion http-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<scope>test</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
*/
package com.wultra.core.http.common.headers;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
import tools.jackson.core.JacksonException;
import tools.jackson.databind.ObjectMapper;
import tools.jackson.databind.json.JsonMapper;

import java.util.stream.Stream;

Expand All @@ -44,7 +45,7 @@ void testParse(final String userAgent, final UserAgent.Device expectedDevice) {
assertEquals(expectedDevice, deviceOptional.get());
}

private static Stream<Arguments> provideUserAgents() throws JsonProcessingException {
private static Stream<Arguments> provideUserAgents() throws JacksonException {
return Stream.of(
Arguments.of("PowerAuthNetworking/1.1.7 (en; cellular) com.wultra.app.Mobile-Token.wultra_test/2.0.0 (Apple; iOS/16.6.1; iphone12,3)", readDevice("""
{
Expand Down Expand Up @@ -127,8 +128,9 @@ private static Stream<Arguments> provideUserAgents() throws JsonProcessingExcept
);
}

private static UserAgent.Device readDevice(final String json) throws JsonProcessingException {
return new ObjectMapper().readValue(json, UserAgent.Device.class);
private static UserAgent.Device readDevice(final String json) throws JacksonException {
ObjectMapper objectMapper = JsonMapper.builder().build();
return objectMapper.readValue(json, UserAgent.Device.class);
}

}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<maven-enforcer-plugin.version>3.6.2</maven-enforcer-plugin.version>

<!-- Dependencies -->
<spring-boot.version>3.5.14</spring-boot.version>
<spring-boot.version>4.0.6</spring-boot.version>
<shedlock.version>7.7.0</shedlock.version>
</properties>

Expand Down
9 changes: 8 additions & 1 deletion rest-client-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,19 @@
<groupId>com.wultra.core</groupId>
<artifactId>rest-model-base</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-classes-epoll</artifactId>
</dependency>

<!-- WebClient do not support digest authentication so far -->
<dependency>
Expand Down
Loading
Loading