1 spring.factories
org.springframework.boot.autoconfigure.EnableAutoConfiguration=package.xxxAutoConfiguration
2 xxxAutoConfiguration
@Configuration
public class xxxAutoConfiguration{
@Profile({ "sit", "autotest" })
@Bean
public XxxRepository createTestRepository() {
InnerClass in = new InnerClass("conf/sit.properties");
return new XxxRepository(in);
}
@Profile({"prd" })
@Bean
public XxxRepository createPrdRepository() {
InnerClass in = new InnerClass("conf/prd.properties");
return new XxxRepository(in);
}
}
3 pom
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jdk8</artifactId>
</exclusion>
<exclusion>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>