Search in sources :

Example 1 with ScanPackages

use of io.moyada.spring.boot.sharingan.context.ScanPackages in project dubbo-faker by moyada.

the class SharinganMonitorAutoConfiguration method setBeanFactory.

@Override
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
    ScanPackages bean;
    try {
        bean = beanFactory.getBean(ScanPackages.class);
    } catch (BeansException e) {
        return;
    }
    this.basePackages = bean.getBasePackages();
    if (beanFactory instanceof DefaultListableBeanFactory) {
        ((DefaultListableBeanFactory) beanFactory).removeBeanDefinition(ScanPackages.BEAN_NAME);
        ((DefaultListableBeanFactory) beanFactory).destroyBean(bean);
    }
}
Also used : DefaultListableBeanFactory(org.springframework.beans.factory.support.DefaultListableBeanFactory) ScanPackages(io.moyada.spring.boot.sharingan.context.ScanPackages) BeansException(org.springframework.beans.BeansException)

Aggregations

ScanPackages (io.moyada.spring.boot.sharingan.context.ScanPackages)1 BeansException (org.springframework.beans.BeansException)1 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)1