org.springframework.context.event.AbstractApplicationEventMulticaster

private Collection<ApplicationListener<?>> retrieveApplicationListeners(ResolvableType eventType, Class<?> sourceType, AbstractApplicationEventMulticaster.ListenerRetriever retriever) {    LinkedList allListeners = new LinkedList();    Object beanFactory = this.retrievalMutex;    LinkedHashSet listeners;    LinkedHashSet listenerBeans;    synchronized(this.retrievalMutex) {        listeners = new LinkedHashSet(this.defaultRetriever.applicationListeners);        listenerBeans = new LinkedHashSet(this.defaultRetriever.applicationListenerBeans);    }

Iterator beanFactory1 = listeners.iterator();

while(beanFactory1.hasNext()) {        ApplicationListener listener = (ApplicationListener)beanFactory1.next();        if(this.supportsEvent(listener, eventType, sourceType)) {            if(retriever != null) {                retriever.applicationListeners.add(listener);            }

allListeners.add(listener);        }    }

if(!listenerBeans.isEmpty()) {        BeanFactory beanFactory2 = this.getBeanFactory();        Iterator listener2 = listenerBeans.iterator();

while(listener2.hasNext()) {            String listenerBeanName = (String)listener2.next();

try {                Class listenerType = beanFactory2.getType(listenerBeanName);                if(listenerType == null || this.supportsEvent(listenerType, eventType)) {                    ApplicationListener listener1 = (ApplicationListener)beanFactory2.getBean(listenerBeanName, ApplicationListener.class);                    if(!allListeners.contains(listener1) && this.supportsEvent(listener1, eventType, sourceType)) {                        if(retriever != null) {                            retriever.applicationListenerBeans.add(listenerBeanName);                        }

allListeners.add(listener1);                    }                }            } catch (NoSuchBeanDefinitionException var13) {                ;            }        }    }

AnnotationAwareOrderComparator.sort(allListeners);    return allListeners;}

org.springframework.context.event.AbstractApplicationEventMulticaster

 

时间: 2024-09-24 03:07:58

org.springframework.context.event.AbstractApplicationEventMulticaster的相关文章

java.lang.ClassNotFoundException: org.springframework.context.event.GenericApplicationListener ----good

  Caused by: java.lang.NoClassDefFoundError: org/springframework/context/event/GenericApplicationListener From the above error, application is unable to find the class defined from the jar dependencies. GenericApplicationListener is added from spring

java.lang.NoClassDefFoundError: org/springframework/context/ApplicationListener

问题描述 严重:Servlet/SunUSTthrewload()exceptionjava.lang.NoClassDefFoundError:org/springframework/context/ApplicationListeneratjava.lang.ClassLoader.findBootstrapClass(NativeMethod)atjava.lang.ClassLoader.findBootstrapClassOrNull(ClassLoader.java:1062)atj

Spring的容器内部事件发布

文/杜琪(简书作者) 原文链接:http://www.jianshu.com/p/4f0ad3bb98f0 著作权归作者所有,转载请联系作者获得授权,并标注"简书作者". 自定义事件机制 给出自定义事件类型在某些应用场景下,我们希望关注特定功能的执行情况,这种功能的开始或者结束或者异常都可以看做一个事件,因此需要定义自己的事件类型. package com.javadu.event; import java.util.EventObject; public class MethodEx

spring-boot-starter-parent 1.3.6.RELEASE

2016-11-17 23:43:17.979 DEBUG 3944 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'readSqlSessionFactory'2016-11-17 23:43:17.979 DEBUG 3944 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Creating ins

【spring源码学习】spring的事件发布监听机制源码解析

[一]相关源代码类 (1)spring的事件发布监听机制的核心管理类:org.springframework.context.event.SimpleApplicationEventMulticaster. =>该类的初始化是放在项目加载时,在ioc容器xml配置文件解析加载完毕后,注册bean创建前后置处理实现类(BeanPostProcessor 接口实现),beanFactory配置处理(BeanFactoryPostProcessor接口实现)后,初始化该事件发布监听机制的核心类. pu

Spring4.1新特性——异步调度和事件机制的异常处理

Spring 4.1对异步调用提供了AsyncResult及SuccessCallback.FailureCallback.和异常处理的支持:对事件调度也提供了相应的异常处理器.   1.事件调度异常处理器 1.1.定义异常处理器: Java代码   public class MyErrorHandler implements ErrorHandler {       @Override       public void handleError(Throwable throwable) {  

启动tomcat 报dubbo端口号冲突

问题描述 启动tomcat 报dubbo端口号冲突 启动tomcat ,同时会报下面的错误 14:56:08.607 [localhost-startStop-1] ERROR o.s.web.context.ContextLoader - Context initialization failedcom.alibaba.dubbo.rpc.RpcException: Fail to start server(url: dubbo://172.16.0.62:21889/com.winit.sm

Logback 专题

  spring boot中使用logback时一个一个配置文件示例:简单的:logback-spring.xml <?xml version="1.0" encoding="UTF-8"?> <configuration> <include resource="org/springframework/boot/logging/logback/base.xml" /> <logger name="

为什么我配置Spring的事务后不能得到BEAN

问题描述 我配置Spring的事务后不能得到BEAN如果把事务的部分去掉的话就能够得到下面这是applicationContext.xml<?xml version="1.0" encoding="UTF-8"?><beansxmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-ins