本篇博客将介绍使用redis作为消息中间件和springboot的整合使用;
安装配置redis
请参考笔者另一篇博客,有详细介绍:https://jsbintask.cn/2019/01/24/middleware/redis-install/#more
整合springboot
新建项目
新建一个springboot项目,并且修改application.yml文件,pom如下:
spring:
redis:
host: youripaddress
password: jsbintask
host和password修改成自己的服务器用户名密码。pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cn.jsbintask</groupId