| | |
| | | package com.java110.event.center.init; |
| | | |
| | | import com.java110.common.factory.ApplicationContextFactory; |
| | | import com.java110.event.app.AppEventPublishing; |
| | | import com.java110.event.center.DataFlowEventPublishing; |
| | | import com.java110.event.center.listener.DataFlowListener; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.core.io.ClassPathResource; |
| | | import org.springframework.core.io.support.PropertiesLoaderUtils; |
| | | |
| | | import javax.naming.ConfigurationException; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | |
| | | String[] listeners = properties.getProperty(DATAFLOW_LISTENER).split("\\,"); |
| | | |
| | | for(String listener : listeners){ |
| | | |
| | | //这里不能直接反射,这样 IXXXService 无法注入,所以直接从spring 中获取已经注入的 |
| | | DataFlowListener<?> dataFlowListener = (DataFlowListener<?>) ApplicationContextFactory.getBean(listener); |
| | | |
| | | //将 listener 放入 AppEventPublishing 中方便后期操作 |
| | | //注册侦听 |
| | | DataFlowEventPublishing.addListener(dataFlowListener); |
| | | DataFlowEventPublishing.addListener(listener); |
| | | } |
| | | } |
| | | |