Java properties的使用
在properties文件中
redis.port=xxx.xxx.xxx.xxx
在spring配置类中
@Configuration
@propertySource(“classpath:/properties/redis.properties”)
public class redisConfig{
@Value("redis.port")
private int port;
}
Java properties的使用
在properties文件中
redis.port=xxx.xxx.xxx.xxx
在spring配置类中
@Configuration
@propertySource(“classpath:/properties/redis.properties”)
public class redisConfig{
@Value("redis.port")
private int port;
}