Browse Source

适配jackson2.6

10.0
richie 7 years ago
parent
commit
6d2ab754d3
  1. 16
      fine-redisson/src/com/fr/third/redisson/ConfigSupport.java
  2. 2
      fine-redisson/src/com/fr/third/redisson/codec/JsonJacksonCodec.java

16
fine-redisson/src/com/fr/third/redisson/ConfigSupport.java

@ -127,14 +127,14 @@ public class ConfigSupport {
private ObjectMapper createMapper(JsonFactory mapping) {
ObjectMapper mapper = new ObjectMapper(mapping);
// mapper.addMixIn(MasterSlaveServersConfig.class, MasterSlaveServersConfigMixIn.class);
// mapper.addMixIn(SingleServerConfig.class, SingleSeverConfigMixIn.class);
// mapper.addMixIn(Config.class, ConfigMixIn.class);
// mapper.addMixIn(Codec.class, ClassMixIn.class);
// mapper.addMixIn(LoadBalancer.class, ClassMixIn.class);
// FilterProvider filterProvider = new SimpleFilterProvider()
// .addFilter("classFilter", SimpleBeanPropertyFilter.filterOutAllExcept());
// mapper.setFilterProvider(filterProvider);
mapper.addMixIn(MasterSlaveServersConfig.class, MasterSlaveServersConfigMixIn.class);
mapper.addMixIn(SingleServerConfig.class, SingleSeverConfigMixIn.class);
mapper.addMixIn(Config.class, ConfigMixIn.class);
mapper.addMixIn(Codec.class, ClassMixIn.class);
mapper.addMixIn(LoadBalancer.class, ClassMixIn.class);
FilterProvider filterProvider = new SimpleFilterProvider()
.addFilter("classFilter", SimpleBeanPropertyFilter.filterOutAllExcept());
mapper.setFilterProvider(filterProvider);
mapper.setSerializationInclusion(Include.NON_NULL);
return mapper;
}

2
fine-redisson/src/com/fr/third/redisson/codec/JsonJacksonCodec.java

@ -117,7 +117,7 @@ public class JsonJacksonCodec implements Codec {
objectMapper.configure(SerializationFeature.WRITE_BIGDECIMAL_AS_PLAIN, true);
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
objectMapper.configure(MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true);
// objectMapper.addMixIn(Throwable.class, ThrowableMixIn.class);
objectMapper.addMixIn(Throwable.class, ThrowableMixIn.class);
}
@Override

Loading…
Cancel
Save