将Spring主题对象存储在Spring Data Redis StackOverflowError中的对象中

时间:2016-10-05 18:13:30

标签: java spring redis spring-data-redis

我想在Redis中存储具有主题对象的对象。目前我可以存储一个普通对象,即使是一个有另一个对象的对象。 但我需要包含一个Theme对象。 主题界面如下所示:

public interface Theme {
    String getName();

    MessageSource getMessageSource();
}  

MessageSource接口如下所示:

public interface MessageSource {
    String getMessage(String var1, Object[] var2, String var3, Locale var4);

    String getMessage(String var1, Object[] var2, Locale var3) throws NoSuchMessageException;

    String getMessage(MessageSourceResolvable var1, Locale var2) throws NoSuchMessageException;
}

但是我收到了stackoverflow错误:

java.lang.StackOverflowError: null
    at org.springframework.util.ObjectUtils.nullSafeHashCode(ObjectUtils.java:381) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService$ConverterCacheKey.hashCode(GenericConversionService.java:464) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.util.ConcurrentReferenceHashMap.getHash(ConcurrentReferenceHashMap.java:214) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.util.ConcurrentReferenceHashMap.getReference(ConcurrentReferenceHashMap.java:246) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.util.ConcurrentReferenceHashMap.get(ConcurrentReferenceHashMap.java:226) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.getConverter(GenericConversionService.java:253) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:190) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:176) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.toBytes(MappingRedisConverter.java:729) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeToBucket(MappingRedisConverter.java:537) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.access$1000(MappingRedisConverter.java:109) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:434) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeInternal(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.access$900(MappingRedisConverter.java:109) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:429) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeInternal(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.access$900(MappingRedisConverter.java:109) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:429) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeInternal(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeCollection(MappingRedisConverter.java:518) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.access$800(MappingRedisConverter.java:109) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:417) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.writeInternal(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter.access$900(MappingRedisConverter.java:109) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:429) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.redis.core.convert.MappingRedisConverter$3.doWithPersistentProperty(MappingRedisConverter.java:395) ~[spring-data-redis-1.7.4.RELEASE.jar:na]
    at org.springframework.data.mapping.model.BasicPersistentEntity.doWithProperties(BasicPersistentEntity.java:309) ~[spring-data-commons-1.11.4.RELEASE.jar:na]

0 个答案:

没有答案