in my target folder, there are 2 folders, lib and conf. all the properties files are placed in conf folder, and jars are placed in lib foulder.
previous to spring
Found an solution:
first create a class and add @ConfigurationProperties
@ConfigurationProperties(prefix = "asdf", locations = "file:conf/aaa.properties")
public class ASDF {
private String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
Please noted in locations, i use file, not classpath.
then in your application class, add @EnableConfigurationProperties
@SpringBootApplication
@EnableConfigurationProperties({ASDF.class, BBB.class})
public class InitialBeanTestApplication {
public static void main(String[] args) {
SpringApplication.run(InitialBeanTestApplication.class, args);
}
}
then you can read config file in the conf folder