Good evening everyone. I have a class that is designed for binding with properties. In the class labeled @Configuration, I make this bean object like:
// Into TargetConfiguration class
@Bean("someBeanName")
@ConfigurationProperties("some.path")
public beanProperties() {
return new BeanProperties();
}
I would like to test all the functionality of this configuration and for this I create a test class like:
@WebFluxTest
@TestPropertySource("classpath:test.properties")
@ContextConfiguration(classes = {TargetConfiguration.class})
class Test {...}
The problem is that BeanProperties will contain null fields, but if I make some otherOtherBeanProperties and register it via @EnableConfigurationProperties inTargetConfiguration, then it will be normally filled, but for BeanProperties I can’t do this, since this bean depends on the property in test.properties. Also if I create this bean through the @TestConfiguration configuration, then it will be filled to...
Any help is appreciated.
UPD-1: The first assumption - I register some class which extends BeanDefinitionRegistryPostProcessor with @DependsOn annotation named RegistratorClass. I don't know why, but if i add @DependsOn on RegistratorClass class, my BeanProperties immediately constructed without binding (And passing to other method which want to receiver this BeanProperties). If i remove this annotation, RegistratorClass initialized the first and my BeanProperties will be normally constructed and bound to properties.