Spring-ApplicationListener
Spring initApplicationEventMulticaster Author: HuiFer 源码阅读仓库: SourceHot-Spring demo 1 2 3 4 5 6 7 8 9 10 11 package com.huifer.source.spring.applicationListener; import org.springframework.context.ApplicationEvent; import org.springframework.context.ApplicationListener; public class DemoApplicationListener implements ApplicationListener { @Override public void onApplicationEvent(ApplicationEvent event) { System.out.println("com.huifer.source.spring.applicationListener.DemoApplicationListener.onApplicationEvent"); } } 1 2 3 4 5 6 7 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="demoApplicationListener" class="com.huifer.source.spring.applicationListener.DemoApplicationListener"/> </beans> 1 2 3 4 5 public class ListenerSourceCode { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("Listener-demo.xml"); } } 初始化入口 org.springframework.context.support.AbstractAppli……