|
@@ -0,0 +1,28 @@
|
|
|
+package com.citygis.commonboot.redisson;
|
|
|
+
|
|
|
+import org.redisson.Redisson;
|
|
|
+import org.redisson.api.RedissonClient;
|
|
|
+import org.redisson.config.Config;
|
|
|
+import org.redisson.config.SingleServerConfig;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
|
+import org.springframework.context.annotation.Configuration;
|
|
|
+
|
|
|
+@Configuration
|
|
|
+public class RedissonConfiguration {
|
|
|
+
|
|
|
+ @Value("${redis.host}")
|
|
|
+ private String host;
|
|
|
+ @Value("${redis.port}")
|
|
|
+ private String port;
|
|
|
+ @Value("${redis.password}")
|
|
|
+ private String password;
|
|
|
+
|
|
|
+ @Bean
|
|
|
+ public RedissonClient getRedisson() {
|
|
|
+ Config config = new Config();
|
|
|
+ SingleServerConfig singleServerConfig = config.useSingleServer();
|
|
|
+ singleServerConfig.setAddress("redis://" + host + ":" + port).setPassword(password);
|
|
|
+ return Redisson.create(config);
|
|
|
+ }
|
|
|
+}
|