Commit a3f37a4a by QIANGLU

新增redis基础组件

parent 4961ce50
......@@ -26,7 +26,7 @@ public class ApolloContextInitializer implements ApplicationContextInitializer<C
if (!StringUtils.isEmpty(appId)) {
System.setProperty("app.id", appId);
System.setProperty("apollo.cacheDir", cacheDir);
System.setProperty("apollo.bootstrap.enabled","true");
System.setProperty("apollo.bootstrap.eagerLoad.enabled","true");
}
}
......
......@@ -10,19 +10,25 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>redis-starter</artifactId>
<dependencies>
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>common-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.secoo.mall.redis.config;
import com.secoo.mall.redis.utils.RedefineClusterUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.serializer.StringRedisSerializer;
/**
* Created by QIANG
*
* @author QIANG
*/
@Configuration
public class MatrixeRedisAutoConfiguration {
@Bean
@ConditionalOnMissingBean(name = "redisTemplate")
public RedisTemplate<Object, Object> redisTemplate(
RedisConnectionFactory redisConnectionFactory) {
RedisTemplate<Object, Object> template = new RedisTemplate<>();
template.setConnectionFactory(redisConnectionFactory);
template.setDefaultSerializer(new StringRedisSerializer());
return template;
}
@Bean
@ConditionalOnMissingBean(RedefineClusterUtils.class)
public RedefineClusterUtils jedisClusterUtils() {
return new RedefineClusterUtils();
}
}
# Auto Configure
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.secoo.mall.redis.config.MatrixeRedisAutoConfiguration
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment