Java 类org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor 实例源码

项目:cas-5.1.0    文件:CasConfigurationPropertiesEnvironmentManager.java   
/**
 * Rebind cas configuration properties.
 *
 * @param binder the binder
 */
public static void rebindCasConfigurationProperties(final ConfigurationPropertiesBindingPostProcessor binder) {
    Assert.notNull(binder, "Configuration binder cannot be null");

    final ApplicationContext applicationContext = ApplicationContextProvider.getApplicationContext();
    final Map<String, CasConfigurationProperties> map = applicationContext.getBeansOfType(CasConfigurationProperties.class);
    final String name = map.keySet().iterator().next();
    LOGGER.debug("Reloading CAS configuration via [{}]", name);
    final Object e = applicationContext.getBean(name);
    binder.postProcessBeforeInitialization(e, name);
    final Object bean = applicationContext.getAutowireCapableBeanFactory().initializeBean(e, name);
    applicationContext.getAutowireCapableBeanFactory().autowireBean(bean);
    LOGGER.debug("Reloaded CAS configuration [{}]", name);
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:OverrideAutoConfigurationEnabledTrueIntegrationTest.java   
@Test
public void autoConfiguredContext() throws Exception {
    ApplicationContext context = this.context;
    assertThat(context.getBean(ExampleSpringBootApplication.class)).isNotNull();
    assertThat(context.getBean(ConfigurationPropertiesBindingPostProcessor.class))
            .isNotNull();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:OverrideAutoConfigurationEnabledFalseIntegrationTest.java   
@Test
public void disabledAutoConfiguration() throws Exception {
    ApplicationContext context = this.context;
    assertThat(context.getBean(ExampleTestConfig.class)).isNotNull();
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    context.getBean(ConfigurationPropertiesBindingPostProcessor.class);
}
项目:spring-boot-concourse    文件:OverrideAutoConfigurationEnabledTrueIntegrationTest.java   
@Test
public void autoConfiguredContext() throws Exception {
    ApplicationContext context = this.context;
    assertThat(context.getBean(ExampleSpringBootApplication.class)).isNotNull();
    assertThat(context.getBean(ConfigurationPropertiesBindingPostProcessor.class))
            .isNotNull();
}
项目:spring-boot-concourse    文件:OverrideAutoConfigurationEnabledFalseIntegrationTest.java   
@Test
public void disabledAutoConfiguration() throws Exception {
    ApplicationContext context = this.context;
    assertThat(context.getBean(ExampleTestConfig.class)).isNotNull();
    this.thrown.expect(NoSuchBeanDefinitionException.class);
    context.getBean(ConfigurationPropertiesBindingPostProcessor.class);
}
项目:spring-cloud-function    文件:FunctionProxyApplicationListener.java   
private void bind(ConfigurableApplicationContext context) {
    ConfigurationPropertiesBindingPostProcessor post = new ConfigurationPropertiesBindingPostProcessor();
    post.setBeanFactory(new DefaultListableBeanFactory());
    post.setEnvironment(context.getEnvironment());
    post.setApplicationContext(new StaticApplicationContext());
    try {
        post.afterPropertiesSet();
    }
    catch (Exception e) {
        throw new IllegalStateException("Cannot bind properties", e);
    }
    post.postProcessBeforeInitialization(this, getClass().getName());
}