自定义名称的配置文件的加载:
package com.flint.main;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class MyConfigApp {
public static void main(String[] args) {
new SpringApplicationBuilder(MyConfigApp.class).properties(
"spring.config.location=classpath:/flint.properties").run(args);
}
}
yml 配置文件的profile
package com.flint.main;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@SpringBootApplication
public class MyConfigAppProfile {
public static void main(String[] args) {
new SpringApplicationBuilder(MyConfigAppProfile.class).properties(
"spring.profiles.active=windows").run(args);
}
}