小编这次要给大家分享的是java Spring Boot如何配置redis pom文件,文章内容丰富,感兴趣的小伙伴可以来了解一下,希望大家阅读完这篇文章之后能够有所收获。

1.创建一个redis maven项目,在pom中添加如下信息

spring boot 版本

<parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.4.RELEASE</version></parent>

项目相关jar配置

<dependencies> <!-- 热开发注解 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <optional>true</optional> </dependency> <!--redis jar--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>

补充知识:Java中使用redis所需要的pom依赖

我就废话不多说了,大家还是直接看代码吧~

<dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.1.0</version></dependency><dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> <version>3.3.2</version></dependency>

看完这篇关于java Spring Boot如何配置redis pom文件的文章,如果觉得文章内容写得不错的话,可以把它分享出去给更多人看到。