use LettuceConnectionFactory for SpringDataRedisStarterTest
@@ -13,6 +13,9 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
+import org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
@@ -51,4 +54,12 @@ public class SpringDataRedisStarterTest extends SpringTest {
public MyFactoryBean factoryBean() {
return new MyFactoryBean();
}
+
+ @Bean
+ public RedisConnectionFactory redisConnectionFactory() {
+ LettuceConnectionFactory connectionFactory = new LettuceConnectionFactory(
+ new RedisStandaloneConfiguration("127.0.0.1", 6379));
+ connectionFactory.afterPropertiesSet();
+ return connectionFactory;
+ }
}
