Search in sources :

Example 1 with AnnotationBean

use of com.alibaba.dubbo.config.spring.AnnotationBean in project spring-boot-starter-dubbo by teaey.

the class DubboConfigurationApplicationContextInitializer method initialize.

@Override
public void initialize(ConfigurableApplicationContext applicationContext) {
    Environment env = applicationContext.getEnvironment();
    String scan = env.getProperty("spring.dubbo.scan");
    if (scan != null) {
        AnnotationBean scanner = BeanUtils.instantiate(AnnotationBean.class);
        scanner.setPackage(scan);
        scanner.setApplicationContext(applicationContext);
        applicationContext.addBeanFactoryPostProcessor(scanner);
        applicationContext.getBeanFactory().addBeanPostProcessor(scanner);
        applicationContext.getBeanFactory().registerSingleton("annotationBean", scanner);
    }
}
Also used : AnnotationBean(com.alibaba.dubbo.config.spring.AnnotationBean) Environment(org.springframework.core.env.Environment)

Aggregations

AnnotationBean (com.alibaba.dubbo.config.spring.AnnotationBean)1 Environment (org.springframework.core.env.Environment)1