@Component
public class MyBean {
@Value("${name}")
private String name;
}
@FeignClient(value = "oidcClient", url="${feign.client.config.oidc.root}")
public interface OidcClient {
}
@ConfigurationProperties(prefix="acme")
@Validated
public class AcmeProperties {
@NotNull
private InetAddress remoteAddress;
}
@Component
@PropertySource("classpath:global.properties")
public class GlobalProperties {
@Value("${thread-pool}")
private int threadPool;
@Value("${email}")
private String email;
}
@Configuration
@EnableConfigurationProperties(AcmeProperties.class)
public class MyConfiguration {
}
file:./custom-config/
classpath:custom-config/
file:./config/
file:./
classpath:/config/
classpath:/
Put a break-point in PropertySourcesPropertyResolver
line 81. The sources and
extracted values could be seen in propertySource.source
. These are the default
provided sources:
- "MapPropertySource {name='Inlined Test Properties'}"
- "MapPropertySource {name='systemProperties'}"
- "SystemEnvironmentPropertySource {name='systemEnvironment'}"
- "RandomValuePropertySource {name='random'}"
- "ConfigurationPropertySources {name='applicationConfigurationProperties'}"
- applicationConfig: [classpath:/application.yml]
- "MapPropertySource {name='springCloudClientHostInfo'}"
- "MapPropertySource {name='defaultProperties'}"
----------------------------------------- 2018-06-30 04:52:46