springboot集成redis

虽然每次都在做,但没有记录下来,此次记录一下操作过程。

环境: window x64

1. 下载一个redis

https://github.com/ServiceStack/redis-windows/tree/master/downloads

2. 安装

解压: D:\Program Files (x86)\webServer\redis-64.3.0.503

3. 修改配置

redis.windows.conf --> line:386 设置密码 requirepass urpass , line:468 可设置占用最大空间等。

4. 启动测试,cmd命令窗口

cd D:\Program Files (x86)\webServer\redis-64.3.0.503
d:
redis-server.exe redis.windows.conf

5. 将redis设置成系统服务,cmd命令窗口

redis-server –service-install redis.windows.conf –loglevel verbose

6. 启动服务,cmd命令窗口

cmd -- > services.msc --> 找到服务并启动。

7. application-dev.properties 配置

#redis缓存服务器配置
spring.redis.host=localhost  
spring.redis.port=6379
spring.redis.password=123456
spring.redis.database=1  
spring.redis.pool.max-active=5  
spring.redis.pool.max-wait=-1
spring.redis.pool.max-idle=500  
spring.redis.pool.min-idle=0  
spring.redis.timeout=0

8. 项目添加依赖,pom.xml

<dependency>  
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-data-redis</artifactId>  
</dependency>  


  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Spring Boot中集成Redis可以通过以下步骤实现: 1. 引入spring-boot-starter-data-redis依赖。在项目的pom.xml文件中,添加以下依赖项: ``` <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> ``` 这将自动引入与Redis集成所需的依赖项。 2. 在Spring Boot的核心配置文件application.properties中配置Redis连接信息。在该文件中添加以下配置项: ``` spring.redis.host=127.0.0.1 spring.redis.port=6379 spring.redis.password=123456 ``` 根据你的实际情况,将host、port和password替换为相应的值。这些配置将用于建立与Redis服务器的连接。 通过以上步骤,你就成功地在Spring Boot应用程序中集成Redis。现在,你可以使用Spring Data Redis的API来访问和操作Redis数据库。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *3* [SpringBoot集成redis](https://blog.csdn.net/qq_43512320/article/details/122684865)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] - *2* [springboot集成Redis](https://blog.csdn.net/m0_54853420/article/details/126515971)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值