SpringBoot自定义属性配置读取 概述: SpringBoot读取配置文件,将配置文件内容注入到Entity或者配置字段中。 将配置文件注入到Entity中 1.在application.yml中自定义配置如下属性,girl,cupsize,age,content:注意content的内容可以使用$取出来。 2.定义一个Entity,给出set,get方法。加上注......
@SpringBootApplication@PropertySource(value={"classpath:application.properties"})publicclassSpringbootrestdemoApplication{publicstaticvoidmain(String[] args){ SpringApplication.run(SpringbootrestdemoApplication.class, args); } } 按Profile不同环境读取不同配置 (推荐这种方法) 不同环境的配置设置一个配置文件,...