@Test
 public void testPropertyPlaceholderConfigurerPresent() throws FileNotFoundException {
   IntegrationContext ic =
       (IntegrationContext)
           builder.build(new FileInputStream("src/test/resources/messageflow1.groovy"));
   GenericApplicationContext gac = (GenericApplicationContext) ic.getApplicationContext();
   boolean ppcPresent = false;
   for (Object obj : gac.getBeanFactoryPostProcessors()) {
     System.out.println(obj.getClass().getName());
     ppcPresent = ppcPresent || obj instanceof PropertySourcesPlaceholderConfigurer;
   }
   assertTrue(ppcPresent);
 }
Пример #2
0
  private void invokeOnChangeListener(Map event) {
    onChangeListener.setDelegate(this);
    onChangeListener.call(new Object[] {event});

    // Apply any factory post processors in case the change listener has changed any
    // bean definitions (GRAILS-5763)
    if (applicationContext instanceof GenericApplicationContext) {
      GenericApplicationContext ctx = (GenericApplicationContext) applicationContext;
      ConfigurableListableBeanFactory beanFactory = ctx.getBeanFactory();
      for (BeanFactoryPostProcessor postProcessor : ctx.getBeanFactoryPostProcessors()) {
        postProcessor.postProcessBeanFactory(beanFactory);
      }
    }
  }
  private void invokeOnChangeListener(Map event) {
    onChangeListener.setDelegate(this);
    onChangeListener.call(new Object[] {event});

    // Apply any factory post processors in case the change listener has changed any
    // bean definitions (GRAILS-5763)
    if (applicationContext instanceof GenericApplicationContext) {
      GenericApplicationContext ctx = (GenericApplicationContext) applicationContext;
      ConfigurableListableBeanFactory beanFactory = ctx.getBeanFactory();
      for (BeanFactoryPostProcessor postProcessor : ctx.getBeanFactoryPostProcessors()) {
        try {
          postProcessor.postProcessBeanFactory(beanFactory);
        } catch (IllegalStateException e) {
          // post processor doesn't allow running again, just continue
        }
      }
    }
  }