|
|
@ -19,7 +19,6 @@ import java.io.IOException;
|
|
|
|
|
|
|
|
|
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.Test;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
|
|
import org.springframework.beans.factory.config.BeanDefinition;
|
|
|
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
|
|
|
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
|
|
|
import org.springframework.beans.factory.support.GenericBeanDefinition;
|
|
|
@ -70,23 +69,13 @@ public class EnableConfigurationPropertiesImportSelectorTests {
|
|
|
|
assertThat(beanDefinition).isExactlyInstanceOf(GenericBeanDefinition.class);
|
|
|
|
assertThat(beanDefinition).isExactlyInstanceOf(GenericBeanDefinition.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void typeWithAutowiredOnConstructorShouldRegisterGenericBeanDefinition()
|
|
|
|
|
|
|
|
throws Exception {
|
|
|
|
|
|
|
|
this.registrar.registerBeanDefinitions(
|
|
|
|
|
|
|
|
getAnnotationMetadata(TestConfiguration.class), this.beanFactory);
|
|
|
|
|
|
|
|
BeanDefinition beanDefinition = this.beanFactory.getBeanDefinition(
|
|
|
|
|
|
|
|
"bar-org.springframework.boot.context.properties.EnableConfigurationPropertiesImportSelectorTests$BarProperties");
|
|
|
|
|
|
|
|
assertThat(beanDefinition).isExactlyInstanceOf(GenericBeanDefinition.class);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void typeWithOneConstructorWithParametersShouldRegisterConfigurationPropertiesBeanDefinition()
|
|
|
|
public void typeWithOneConstructorWithParametersShouldRegisterConfigurationPropertiesBeanDefinition()
|
|
|
|
throws Exception {
|
|
|
|
throws Exception {
|
|
|
|
this.registrar.registerBeanDefinitions(
|
|
|
|
this.registrar.registerBeanDefinitions(
|
|
|
|
getAnnotationMetadata(TestConfiguration.class), this.beanFactory);
|
|
|
|
getAnnotationMetadata(TestConfiguration.class), this.beanFactory);
|
|
|
|
BeanDefinition beanDefinition = this.beanFactory.getBeanDefinition(
|
|
|
|
BeanDefinition beanDefinition = this.beanFactory.getBeanDefinition(
|
|
|
|
"baz-org.springframework.boot.context.properties.EnableConfigurationPropertiesImportSelectorTests$BazProperties");
|
|
|
|
"bar-org.springframework.boot.context.properties.EnableConfigurationPropertiesImportSelectorTests$BarProperties");
|
|
|
|
assertThat(beanDefinition)
|
|
|
|
assertThat(beanDefinition)
|
|
|
|
.isExactlyInstanceOf(ConfigurationPropertiesBeanDefinition.class);
|
|
|
|
.isExactlyInstanceOf(ConfigurationPropertiesBeanDefinition.class);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -135,7 +124,7 @@ public class EnableConfigurationPropertiesImportSelectorTests {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@EnableConfigurationProperties({ FooProperties.class, BarProperties.class,
|
|
|
|
@EnableConfigurationProperties({ FooProperties.class, BarProperties.class,
|
|
|
|
BazProperties.class, BingProperties.class })
|
|
|
|
BingProperties.class })
|
|
|
|
static class TestConfiguration {
|
|
|
|
static class TestConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -163,22 +152,12 @@ public class EnableConfigurationPropertiesImportSelectorTests {
|
|
|
|
@ConfigurationProperties(prefix = "bar")
|
|
|
|
@ConfigurationProperties(prefix = "bar")
|
|
|
|
public static class BarProperties {
|
|
|
|
public static class BarProperties {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
public BarProperties(String foo) {
|
|
|
|
public BarProperties(String foo) {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ConfigurationProperties(prefix = "baz")
|
|
|
|
|
|
|
|
public static class BazProperties {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BazProperties(String foo) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ConfigurationProperties(prefix = "bing")
|
|
|
|
@ConfigurationProperties(prefix = "bing")
|
|
|
|
public static class BingProperties {
|
|
|
|
public static class BingProperties {
|
|
|
|
|
|
|
|
|
|
|
|