java jedis cluster_第三章 springboot + jedisCluster

如果使用的是redis3.x中的集群,在项目中使用jedisCluster。

1、项目结构

0b690a6c536ea9828d22c032c12158a5.png

2、pom.xml

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

1 <?xml version="1.0" encoding="UTF-8"?>

2

3 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

4

5 4.0.0

6

7 com.xxx

8 myboot

9 1.0-SNAPSHOT

10

11

12 1.8

13

14

19

20 org.springframework.boot

21 spring-boot-starter-parent

22 1.2.5.RELEASE

23

24

25

37

38

39

40

41 org.springframework.boot

42 spring-boot-starter-web

43

44

45 redis.clients

46 jedis

47

48

49 com.alibaba

50 fastjson

51 1.1.15

52

53

54 org.apache.commons

55 commons-lang3

56 3.3.2

57

58

59

60

61

62

64

65 org.springframework.boot

66 spring-boot-maven-plugin

67

68

69

70

View Code

说明:相对于上一章的代码仅仅引入了jedis的依赖jar。

3、application.properties

8f900a89c6347c561fdf2122f13be562.png

961ddebeb323a10fe0623af514929fc1.png

1 #user info2 user.id=13 user.username=zhaojigang4 user.password=1235

6 #redis cluster7 redis.cache.clusterNodes=localhost:80808 redis.cache.commandTimeout=59 #unit:second10 redis.cache.expireSeconds=120

View Code

说明:相对于上一章的代码仅仅引入了redis cluster的配置信息

4、Application.java(springboot启动类,与上一章一样)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值