technology-note/java/springboot系列/数据库/springboot整合redis.md
2019-02-22 17:14:44 +08:00

35 lines
1.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: "2019-02-22-14-59"
title: "springboot整合Mybatis(xml和注解)"
tag: ["java", "","spring-boot","redis","nosql"]
categories:
- "java"
- "spring boot学习"
---
  项目源代码在 github地址为[https://github.com/FleyX/demo-project/tree/master/mybatis-test](https://github.com/FleyX/demo-project/tree/master/mybatis-test),有需要的自取。
  redis作为一个高性能的内存数据库如果不会用就太落伍了之前在node.js中用过redis本篇记录如何将redis集成到spring boot中。提供redis操作类和注解使用redis两种方式。主要内容如下
- docker安装redis
- springboot 集成redis
- 编写redis操作类
- 通过注解使用redis
# 安装redis
  通过docker安装docker compose编排文件如下
```yml
# docker-compose.yml
version: "3"
services:
redis:
container_name: redis
image: redis:3.2.10
ports:
- "6379:6379"
```
  然后在`docker-compose.yml`所在目录使用`docker-compose up -d`命令启动redis。
# 集成springboot