View Javadoc
1   package com.atlassian.plugin.osgi.spring;
2   
3   import org.eclipse.gemini.blueprint.extender.OsgiBeanFactoryPostProcessor;
4   import org.osgi.framework.BundleContext;
5   import org.springframework.beans.BeansException;
6   import org.springframework.beans.factory.BeanFactoryAware;
7   import org.springframework.beans.factory.config.BeanDefinition;
8   import org.springframework.beans.factory.config.BeanPostProcessor;
9   import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
10  import org.springframework.beans.factory.support.BeanDefinitionRegistry;
11  import org.springframework.beans.factory.support.RootBeanDefinition;
12  import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
13  
14  import java.util.function.Supplier;
15  
16  import static com.atlassian.plugin.osgi.spring.BeanFactoryPostProcessorUtils.registerPostProcessor;
17  import static org.springframework.context.annotation.AnnotationConfigUtils.COMMON_ANNOTATION_PROCESSOR_BEAN_NAME;
18  
19  public class CommonAnnotationBeanFactoryPostProcessor implements OsgiBeanFactoryPostProcessor {
20      @Override
21      public void postProcessBeanFactory(final BundleContext bundleContext, final ConfigurableListableBeanFactory beanFactory) throws BeansException {
22          registerPostProcessor(beanFactory,
23                                COMMON_ANNOTATION_PROCESSOR_BEAN_NAME,
24                                CommonAnnotationBeanPostProcessor.class,
25                                CommonAnnotationBeanPostProcessor::new);
26      }
27  }