赞
踩
springboot 连接redis 并设置key前缀
properties中配置
#redis
redis.masterClusterNodes=10.40.57.197:7000;10.40.57.198:7002;10.40.57.199:7004
redis.slaveClusterNodes=10.40.57.197:7001;10.40.57.198:7003;10.40.57.199:7005
redis.maxTotal=50
redis.maxIdle=10
redis.minIdle=1
redis.maxWaitMillis=1000
redis.testOnBorrow=true
redis.testOnReturn=true
redis.timeout=10000
redis.lockExpireSeconds=5
redis.soTimeout=1000
redis.maxAttempts=3
redis.password=123456
redis.clientName=clientName
redis.keyPrefix=0000-->
读取配置文件内容:
@Component
@ConfigurationProperties(prefix = "redis")
@PropertySource("classpath:redis.properties")
public class RedisProperties {
/**
* m
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。