Search in sources :

Example 6 with PropertySources

use of org.springframework.core.env.PropertySources in project spring-boot by spring-projects.

the class PropertySourcesDeducerTests method getPropertySourcesWhenHasSinglePropertySourcesPlaceholderConfigurerReturnsBean.

@Test
void getPropertySourcesWhenHasSinglePropertySourcesPlaceholderConfigurerReturnsBean() {
    ApplicationContext applicationContext = new AnnotationConfigApplicationContext(PropertySourcesPlaceholderConfigurerConfiguration.class);
    PropertySourcesDeducer deducer = new PropertySourcesDeducer(applicationContext);
    PropertySources propertySources = deducer.getPropertySources();
    assertThat(propertySources.get("test")).isInstanceOf(TestPropertySource.class);
}
Also used : ApplicationContext(org.springframework.context.ApplicationContext) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) PropertySources(org.springframework.core.env.PropertySources) MutablePropertySources(org.springframework.core.env.MutablePropertySources) Test(org.junit.jupiter.api.Test)

Aggregations

PropertySources (org.springframework.core.env.PropertySources)6 MutablePropertySources (org.springframework.core.env.MutablePropertySources)5 AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)4 Test (org.junit.jupiter.api.Test)3 ApplicationContext (org.springframework.context.ApplicationContext)3 RelaxedPropertyResolver (org.springframework.boot.bind.RelaxedPropertyResolver)2 ConfigurableEnvironment (org.springframework.core.env.ConfigurableEnvironment)2 PropertySourcesPropertyResolver (org.springframework.core.env.PropertySourcesPropertyResolver)2 PropertySourcesPlaceholderConfigurer (org.springframework.context.support.PropertySourcesPlaceholderConfigurer)1 FileSystemResource (org.springframework.core.io.FileSystemResource)1