spring-boot集成redis单机版
来源:互联网 发布:linux 毫秒级的 sleep 编辑:程序博客网 时间:2024/05/16 11:02
1、注入redis依赖
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-redis</artifactId> </dependency>
2、在配置文件application.yml中添加redis信息
spring: redis: database: 0 host: 127.0.0.1 port: 6379 password: pool: max-active: 8 max-wait: -1 max-idle: 8 min-idle: 0 timeout: 03、编写测试接口
import org.springframework.beans.factory.annotation.Autowired;import org.springframework.data.redis.core.RedisTemplate;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;/** * Created by 赵亚辉 on 2017/12/5. */@RestController@RequestMapping("/redis")public class RedisController { @Autowired private RedisTemplate redisTemplate; @RequestMapping("/set") public String set(){ redisTemplate.opsForValue().set("ya","hadoop"); String a= (String) redisTemplate.opsForValue().get("ya"); System.out.print("a:"+a); return "success"; }}
阅读全文
0 0
- spring-boot集成redis单机版
- Spring Boot Redis 集成
- Spring Boot集成Redis
- spring-boot 集成 redis
- spring boot 集成redis
- Spring boot集成Redis
- Spring Boot 集成Redis
- spring boot集成redis
- spring boot整合redis(单机+集群)
- spring boot +mybatis+redis集成
- spring-boot-starter-redis 集成
- Spring Boot Redis 集成配置
- spring boot 集成redis 配置
- Spring Boot : 集成redis(九)
- spring-boot-starter-redis 集成
- spring-boot 集成spring-session redis
- spring整合redis单机版
- Spring Boot(五)集成 Redis
- Oracle表导入导出和从一张表创建到另外一张表
- Java的结构体排序
- 好文参考
- Unity安卓移动设备显示Debug.Log信息
- 验证码生成方法
- spring-boot集成redis单机版
- BZOJ 3196: Tyvj 1730 二逼平衡树(一起来码树套树)
- 智能指针
- 聚焦大数据:洞察价值与企业应用落地
- 深入理解脚本化CSS系列第一篇——脚本化行内样式
- 动态规划求编辑距离——算法解题报告
- CodeForces
- YTU.2431: C语言习题 医生值班
- layui回调函数