springboot怎么添加redis依赖
1个回答
展开全部
1、在pom文件中引入即可
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
2、编写一个CacheService接口,使用redisCacheServiceImpl实现这个接口
官网的原文是这样的,也就是说,提供三个接口注入和你自己实现的其他实现类,默认是本地端口号为6379的redis
You can inject an auto-configured RedisConnectionFactory, StringRedisTemplate or vanilla RedisTemplate instance as you would any other Spring Bean.By default the instance will attempt to connect to a Redis server using localhost:6379:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-redis</artifactId>
</dependency>
2、编写一个CacheService接口,使用redisCacheServiceImpl实现这个接口
官网的原文是这样的,也就是说,提供三个接口注入和你自己实现的其他实现类,默认是本地端口号为6379的redis
You can inject an auto-configured RedisConnectionFactory, StringRedisTemplate or vanilla RedisTemplate instance as you would any other Spring Bean.By default the instance will attempt to connect to a Redis server using localhost:6379:
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询