Search in sources :

Example 1 with ListenerInfo

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

the class MonitorBeanDefinitionScanner method processBeanDefinitions.

private void processBeanDefinitions(Set<BeanDefinitionHolder> beanDefinitions) {
    initAppInfo();
    for (BeanDefinitionHolder holder : beanDefinitions) {
        AbstractBeanDefinition definition = (AbstractBeanDefinition) holder.getBeanDefinition();
        Class<?> beanClass = BeanDefinitionUtil.getClass(definition);
        if (null == beanClass) {
            continue;
        }
        ListenerInfo listenerInfo = ListenerAnalyser.getListenerInfo(beanClass);
        if (null == listenerInfo) {
            continue;
        }
        initData(listenerInfo);
        // 修改 BeanDefinition 类信息
        Class<?> newBeanClass = proxy(beanClass, listenerInfo.getListenerMethods());
        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Creating MonitorProxy Wrapper Bean name '" + holder.getBeanName() + "', type is '" + definition.getBeanClassName() + "'");
        }
        definition.setBeanClass(newBeanClass);
    }
}
Also used : ListenerInfo(io.moyada.spring.boot.sharingan.context.ListenerInfo) AbstractBeanDefinition(org.springframework.beans.factory.support.AbstractBeanDefinition) BeanDefinitionHolder(org.springframework.beans.factory.config.BeanDefinitionHolder)

Aggregations

ListenerInfo (io.moyada.spring.boot.sharingan.context.ListenerInfo)1 BeanDefinitionHolder (org.springframework.beans.factory.config.BeanDefinitionHolder)1 AbstractBeanDefinition (org.springframework.beans.factory.support.AbstractBeanDefinition)1