/
AppConfig.java
27 lines (22 loc) · 948 Bytes
/
AppConfig.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package dkwestbr.spring.autowired.example.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
@Configuration
@ComponentScan(basePackages = {"dkwestbr.spring.autowired.example"})
public class AppConfig {
@Bean
private static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
return new PropertySourcesPlaceholderConfigurer();
}
@Configuration
@Profile("test")
@PropertySource("classpath:configuration.properties")
static class Test { }
@Configuration
@PropertySource("classpath:configuration.properties")
static class Production { }
}