SpringBoot配置文件读取
来源:互联网 发布:怎么在知乎发表文章 编辑:程序博客网 时间:2024/05/18 01:19
1. 新建staticCls.properties
com.md.name="abc"com.md.want="def"#该随机值只是每次启动时生成一个固定值com.md.id=${random.int}
2. 新建StaticCls.java
@Configuration@ConfigurationProperties(prefix = "com.md")@PropertySource("classpath:staticCls.properties")public class StaticCls { private Long id; private String name; private String want; get()/set()}
3. 在SpringBoot启动类上加注解
@SpringBootApplication@ComponentScan(basePackages = "com.yweb")/*配置类*/@EnableConfigurationProperties({StaticCls.class})public class Entry { public static void main(String[] args) throws Exception { SpringApplication.run(Entry.class, args); }}
阅读全文
0 0
- SpringBoot读取配置文件乱码
- springboot读取自定义配置文件
- SpringBoot配置文件读取
- SpringBoot读取配置文件
- SpringBoot 读取自定义配置文件
- springboot读取配置文件
- SpringBoot 读取配置文件属性值
- springboot实战之读取配置文件
- Springboot 之 自定义配置文件及读取配置文件
- SpringBoot 读取配置文件及profiles切换配置文件
- Springboot 之 自定义配置文件及读取配置文件
- Springboot 之 自定义配置文件及读取配置文件
- Springboot 之 自定义配置文件及读取配置文件
- Springboot 之 自定义配置文件及读取配置文件
- Springboot 之 自定义配置文件及读取配置文件
- SpringBoot读取配置文件注入到配置类
- 4.Springboot 之 自定义配置文件及读取配置文件
- eclipse 使用maven 构建springboot 读取多个配置文件
- 正则表达式
- Tomact8部署在linux下启动很慢
- js 中的转义字符
- Cmake 找不到OpenCVConfig.cmake文件
- android中对launchMode和task的理解
- SpringBoot配置文件读取
- Notification 使用方法详解
- C++ 之标准库类型—— vector 容器
- Python---ord()与chr()
- solr 6.0 没有schema.xml未自动创建schema文件
- 总结开源jar包的作用
- 垂直同步
- Elasticsearch学习(二) 搜索详解
- 查找算法--数据集合