當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。