MyRedisProperties.java,读取redis配置
package com.redis.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ConfigurationProperties(
prefix = "my.redis"
)
public class MyRedisProperties {
private int database = 0;
private String host = "localhost";
private String password;
private int port = 6379;
private MyRedisProperties.Pool pool;
private MyRedisProperties.Sentinel sentinel;
public MyRedisProperties() {
}
public String getHost() {
return this.host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return this.port;
}
public void setPort(int port) {
this.port = port;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public MyRedisProperties.Pool getPool() {
return this.pool;
}
public void setPool(MyRedisProperties.Pool pool) {
this.pool = pool;
}
public int getDatabase() {
return this.database;
}
public void setDatabase(int database) {
this.database = database;
}
public MyRedisProperties.Sentinel ge