当前位置: 首页>>代码示例>>Java>>正文


Java ApplicationContext.publishEvent方法代码示例

本文整理汇总了Java中org.springframework.context.ApplicationContext.publishEvent方法的典型用法代码示例。如果您正苦于以下问题:Java ApplicationContext.publishEvent方法的具体用法?Java ApplicationContext.publishEvent怎么用?Java ApplicationContext.publishEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.context.ApplicationContext的用法示例。


在下文中一共展示了ApplicationContext.publishEvent方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBootstrapAndShutdown

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public void testBootstrapAndShutdown() throws Exception
{
    // now bring up the bootstrap
    ApplicationContext ctx = new ClassPathXmlApplicationContext(APP_CONTEXT_XML);
    
    // the folder should be gone
    assertFalse("Folder was not deleted by bootstrap", dir.exists());
    
    // now create the folder again
    dir.mkdir();
    assertTrue("Directory not created", dir.exists());
    
    // announce that the context is closing
    ctx.publishEvent(new ContextClosedEvent(ctx));
    
    // the folder should be gone
    assertFalse("Folder was not deleted by shutdown", dir.exists());
}
 
开发者ID:Alfresco,项目名称:alfresco-core,代码行数:19,代码来源:RuntimeExecBeansTest.java

示例2: onApplicationEvent

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
@Override
public void onApplicationEvent(ApplicationEvent event) {
	// Once the context has been refreshed, we tell other interested beans
	// about the existence of this content store
	// (e.g. for monitoring purposes)
	if (event instanceof ContextRefreshedEvent && event.getSource() == this.applicationContext) {
		ApplicationContext context = ((ContextRefreshedEvent) event).getApplicationContext();
		context.publishEvent(new ContentStoreCreatedEvent(this, Collections.<String, Serializable>emptyMap()));
	}
}
 
开发者ID:jeci-sarl,项目名称:alfresco-object-storage-connectors,代码行数:11,代码来源:ObjectStorageContentStore.java

示例3: sessionDestroyed

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
public void sessionDestroyed(HttpSessionEvent se) {
    ApplicationContext ctx = WebApplicationContextUtils
            .getWebApplicationContext(se.getSession().getServletContext());

    if (ctx == null) {
        logger.warn("cannot find applicationContext");

        return;
    }

    HttpSession session = se.getSession();
    UserAuthDTO userAuthDto = this.internalUserAuthConnector
            .findFromSession(session);

    String tenantId = null;

    if (userAuthDto != null) {
        tenantId = userAuthDto.getTenantId();
    }

    LogoutEvent logoutEvent = new LogoutEvent(session, null,
            session.getId(), tenantId);
    ctx.publishEvent(logoutEvent);
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:25,代码来源:LogoutHttpSessionListener.java

示例4: publishEvent

import org.springframework.context.ApplicationContext; //导入方法依赖的package包/类
/**
 * Publishes an event to the application context that will notify any interested parties of the existence of this
 * content store.
 * 
 * @param context
 *            the application context
 * @param extendedEventParams 
 */
private void publishEvent(ApplicationContext context, Map<String, Serializable> extendedEventParams)
{
    context.publishEvent(new ContentStoreCreatedEvent(this, extendedEventParams));
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:13,代码来源:FileContentStore.java


注:本文中的org.springframework.context.ApplicationContext.publishEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。