Authored by LUOXC

Merge branch 'hotfix-20181219' into test6.8.4

@@ -16,6 +16,7 @@ import com.yohoufo.resource.util.RedisLoadingCache; @@ -16,6 +16,7 @@ import com.yohoufo.resource.util.RedisLoadingCache;
16 import com.yohoufo.resource.util.ValueSerializer; 16 import com.yohoufo.resource.util.ValueSerializer;
17 import org.slf4j.Logger; 17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory; 18 import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.InitializingBean;
19 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
20 import org.springframework.stereotype.Service; 21 import org.springframework.stereotype.Service;
21 22
@@ -28,7 +29,7 @@ import java.util.concurrent.TimeUnit; @@ -28,7 +29,7 @@ import java.util.concurrent.TimeUnit;
28 import java.util.stream.Collectors; 29 import java.util.stream.Collectors;
29 30
30 @Service 31 @Service
31 -public class ConfigTypeServiceImpl implements IConfigTypeService { 32 +public class ConfigTypeServiceImpl implements IConfigTypeService, InitializingBean {
32 private static final Logger LOGGER = LoggerFactory.getLogger(ConfigTypeServiceImpl.class); 33 private static final Logger LOGGER = LoggerFactory.getLogger(ConfigTypeServiceImpl.class);
33 34
34 private LocalCache localCache = new LocalCache(); 35 private LocalCache localCache = new LocalCache();
@@ -44,7 +45,11 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { @@ -44,7 +45,11 @@ public class ConfigTypeServiceImpl implements IConfigTypeService {
44 @Redis("yohoNoSyncRedis") 45 @Redis("yohoNoSyncRedis")
45 private YHValueOperations valueOperations; 46 private YHValueOperations valueOperations;
46 47
47 - private final RedisLoadingCache<String, ConfigType> codeConfigTypeRedisCache = RedisCacheBuilder.newBuilder() 48 + private RedisLoadingCache<String, ConfigType> codeConfigTypeRedisCache;
  49 +
  50 + @Override
  51 + public void afterPropertiesSet() throws Exception {
  52 + codeConfigTypeRedisCache = RedisCacheBuilder.newBuilder()
48 .withYhRedis(redisTemplate, valueOperations) 53 .withYhRedis(redisTemplate, valueOperations)
49 .withExpire(5, TimeUnit.SECONDS) 54 .withExpire(5, TimeUnit.SECONDS)
50 .withKeySerializer(new KeySerializer<String>() { 55 .withKeySerializer(new KeySerializer<String>() {
@@ -79,6 +84,7 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { @@ -79,6 +84,7 @@ public class ConfigTypeServiceImpl implements IConfigTypeService {
79 } 84 }
80 85
81 }); 86 });
  87 + }
82 88
83 @PostConstruct 89 @PostConstruct
84 private void init() { 90 private void init() {
@@ -126,4 +132,5 @@ public class ConfigTypeServiceImpl implements IConfigTypeService { @@ -126,4 +132,5 @@ public class ConfigTypeServiceImpl implements IConfigTypeService {
126 return rows; 132 return rows;
127 } 133 }
128 134
  135 +
129 } 136 }