|
@@ -0,0 +1,24 @@
|
|
|
+package com.ywt.alipaympapi.core.configs;
|
|
|
+
|
|
|
+import com.ywt.alipaympapi.core.redis.ShardedJedisPoolFactory;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import redis.clients.jedis.ShardedJedisPool;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by huangguoping.
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class AppConfigurer {
|
|
|
+
|
|
|
+ @Value("${redis.address}")
|
|
|
+ private String redisAddress;
|
|
|
+
|
|
|
+ @Bean(name = "jedisPool")
|
|
|
+ public ShardedJedisPool getJedisPool() throws Exception {
|
|
|
+ ShardedJedisPoolFactory shardedJedisPoolFactory = new ShardedJedisPoolFactory();
|
|
|
+ shardedJedisPoolFactory.setHostAndPorts(redisAddress);
|
|
|
+ return shardedJedisPoolFactory.getObject();
|
|
|
+ }
|
|
|
+}
|