Skip to content

Commit ef1b493

Browse files
committed
fix: Fix redis caching(active events)
1 parent 96fd5e4 commit ef1b493

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

core-service/src/main/java/com/axon/core_service/config/CacheConfig.java

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.axon.core_service.config;
22

3-
import com.fasterxml.jackson.annotation.JsonTypeInfo;
43
import com.fasterxml.jackson.databind.ObjectMapper;
5-
import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
64
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
75
import java.time.Duration;
86
import org.springframework.cache.annotation.EnableCaching;
@@ -25,22 +23,18 @@ public class CacheConfig {
2523

2624
/**
2725
* Configure ObjectMapper for Redis JSON serialization.
28-
* Enables polymorphic type handling and Java 8 time support.
26+
* Only registers JavaTimeModule - GenericJackson2JsonRedisSerializer handles type info.
2927
*/
3028
private ObjectMapper cacheObjectMapper() {
3129
ObjectMapper mapper = new ObjectMapper();
3230

3331
// Register Java 8 date/time module for LocalDateTime serialization
3432
mapper.registerModule(new JavaTimeModule());
3533

36-
// Enable polymorphic type handling with WRAPPER_ARRAY format
37-
// This wraps type information in an array: ["com.example.Type", {...}]
38-
// More compatible with collections and complex types
39-
mapper.activateDefaultTyping(
40-
LaissezFaireSubTypeValidator.instance,
41-
ObjectMapper.DefaultTyping.NON_FINAL,
42-
JsonTypeInfo.As.WRAPPER_ARRAY // Changed from PROPERTY to WRAPPER_ARRAY
43-
);
34+
// NOTE: Do NOT use activateDefaultTyping() here!
35+
// GenericJackson2JsonRedisSerializer already handles polymorphic types
36+
// using its own @class property mechanism. Adding activateDefaultTyping
37+
// causes double type wrapping and deserialization errors.
4438

4539
return mapper;
4640
}

core-service/src/main/resources/templates/fragments/head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838

3939
<!-- Global Styles (Optional Overrides) -->
4040
<link rel="stylesheet" href="/css/style.css">
41+
42+
<!-- Common JavaScript utilities -->
43+
<script th:src="@{/js/common.js}"></script>
4144
</head>
4245

4346
<body>

0 commit comments

Comments
 (0)