|
@@ -2,7 +2,6 @@ package com.sckw.redis.configure;
|
|
|
|
|
|
|
|
import org.redisson.Redisson;
|
|
import org.redisson.Redisson;
|
|
|
import org.redisson.api.RedissonClient;
|
|
import org.redisson.api.RedissonClient;
|
|
|
-import org.redisson.codec.JsonJacksonCodec;
|
|
|
|
|
import org.redisson.config.Config;
|
|
import org.redisson.config.Config;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Bean;
|
|
@@ -21,8 +20,8 @@ public class RedissonConfiguration {
|
|
|
@Value("${spring.data.redis.port}")
|
|
@Value("${spring.data.redis.port}")
|
|
|
private String port;
|
|
private String port;
|
|
|
|
|
|
|
|
-// @Value("${spring.data.redis.password}")
|
|
|
|
|
-// private String password;
|
|
|
|
|
|
|
+ @Value("${spring.data.redis.password}")
|
|
|
|
|
+ private String password;
|
|
|
|
|
|
|
|
@Value("${spring.data.redis.database}")
|
|
@Value("${spring.data.redis.database}")
|
|
|
private String database;
|
|
private String database;
|
|
@@ -33,10 +32,9 @@ public class RedissonConfiguration {
|
|
|
@Bean
|
|
@Bean
|
|
|
public RedissonClient redisson() {
|
|
public RedissonClient redisson() {
|
|
|
Config config = new Config();
|
|
Config config = new Config();
|
|
|
- config.setCodec(new JsonJacksonCodec());
|
|
|
|
|
config.useSingleServer()
|
|
config.useSingleServer()
|
|
|
.setAddress(address())
|
|
.setAddress(address())
|
|
|
-// .setPassword(password)
|
|
|
|
|
|
|
+ .setPassword(password)
|
|
|
.setDatabase(Integer.parseInt(database))
|
|
.setDatabase(Integer.parseInt(database))
|
|
|
.setConnectTimeout(Integer.parseInt(timeout));
|
|
.setConnectTimeout(Integer.parseInt(timeout));
|
|
|
return Redisson.create(config);
|
|
return Redisson.create(config);
|