Class JacksonConfig

java.lang.Object
com.bytedesk.core.config.JacksonConfig

@Configuration @Description("Jackson JSON Configuration - Jackson JSON\u5e8f\u5217\u5316\u914d\u7f6e\u7c7b\uff0c\u5904\u7406\u65e5\u671f\u683c\u5f0f\u3001\u65f6\u533a\u3001\u7a7a\u503c\u7b49") @Role(2) public class JacksonConfig extends Object
Jackson ObjectMapper 配置 提供两种不同的 ObjectMapper 实例: 1. 全局通用的 ObjectMapper (不包含类型信息) 2. Redis专用的 ObjectMapper (包含类型信息)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    自定义 ZonedDateTime 反序列化器 支持多种日期时间格式,包括没有时区信息的格式
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.fasterxml.jackson.databind.ObjectMapper
    创建标准的ObjectMapper实例,用于一般的JSON序列化/反序列化 支持Java 8日期时间类型和循环引用处理,但不包含类型信息
    com.fasterxml.jackson.databind.ObjectMapper
    创建包含类型信息的ObjectMapper实例,专用于Redis缓存和RedisTemplate 支持Java 8日期时间类型和循环引用处理,并包含类型信息以便正确反序列化

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JacksonConfig

      public JacksonConfig()
  • Method Details

    • objectMapper

      @Bean @Primary public com.fasterxml.jackson.databind.ObjectMapper objectMapper()
      创建标准的ObjectMapper实例,用于一般的JSON序列化/反序列化 支持Java 8日期时间类型和循环引用处理,但不包含类型信息
      Returns:
      配置好的ObjectMapper实例
    • redisObjectMapper

      @Bean(name="redisObjectMapper") @Role(2) public com.fasterxml.jackson.databind.ObjectMapper redisObjectMapper()
      创建包含类型信息的ObjectMapper实例,专用于Redis缓存和RedisTemplate 支持Java 8日期时间类型和循环引用处理,并包含类型信息以便正确反序列化
      Returns:
      配置好的Redis专用ObjectMapper实例