1,定义配置文件mypro.properties
ip=http://localhost:8769/
2,在启动类上加上配置注解:
@PropertySource("classpath:mypro.properties")
3,在需要使用的类中使用@Value(${base.redis.url})注解注入配置信息
//获取配置信息 @Value("${spring.datasource.url}") private String url;
1,定义配置文件mypro.properties
ip=http://localhost:8769/
2,在启动类上加上配置注解:
@PropertySource("classpath:mypro.properties")
3,在需要使用的类中使用@Value(${base.redis.url})注解注入配置信息
//获取配置信息 @Value("${spring.datasource.url}") private String url;