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.annotation.AutowiredAnnotationBeanPostProcessor;
7 import org.springframework.beans.factory.config.BeanDefinition;
8 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
9 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
10 import org.springframework.beans.factory.support.RootBeanDefinition;
11 import org.springframework.context.annotation.CommonAnnotationBeanPostProcessor;
12
13 import static org.springframework.context.annotation.AnnotationConfigUtils.AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME;
14
15 public class AutowireSupportBeanFactoryPostProcessor implements OsgiBeanFactoryPostProcessor {
16 @Override
17 public void postProcessBeanFactory(final BundleContext bundleContext, final ConfigurableListableBeanFactory beanFactory) throws BeansException {
18 BeanFactoryPostProcessorUtils.registerPostProcessor(
19 beanFactory,
20 AUTOWIRED_ANNOTATION_PROCESSOR_BEAN_NAME,
21 AutowiredAnnotationBeanPostProcessor.class,
22 AutowiredAnnotationBeanPostProcessor::new);
23 }
24 }