All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alanpoi.etactivity.agent.ActivityBeanRegistry Maven / Gradle / Ivy

There is a newer version: 1.3.8
Show newest version
package com.alanpoi.etactivity.agent;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;

/**
 * Bean registry
 *
 * @author pengzhuoxun
 * @since 1.3.0
 */
@Component
public class ActivityBeanRegistry implements BeanDefinitionRegistryPostProcessor, ResourceLoaderAware, BeanFactoryAware {

    private ResourceLoader resourceLoader;


    @Override
    public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
        ActivityClassPathBeanDefinitionScanner scanner = new ActivityClassPathBeanDefinitionScanner(registry, false);
        scanner.setResourceLoader(resourceLoader);
        scanner.registerDefaultFilters();
        scanner.doScan("com.alanpoi.etactivity");
    }

    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
    }

    @Override
    public void setResourceLoader(ResourceLoader resourceLoader) {
        this.resourceLoader = resourceLoader;
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy