org.springframework.context.ApplicationEvent类的使用及代码示例

x33g5p2x  于10个月前 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(31)

本文整理了Java中org.springframework.context.ApplicationEvent类的一些代码示例,展示了ApplicationEvent类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ApplicationEvent类的具体详情如下:
包路径:org.springframework.context.ApplicationEvent
类名称:ApplicationEvent

ApplicationEvent介绍

[英]Class to be extended by all application events. Abstract as it doesn't make sense for generic events to be published directly.
[中]类将由所有应用程序事件扩展。抽象,因为直接发布泛型事件没有意义。

代码示例

代码示例来源:origin: apache/incubator-dubbo

/**
   * Get {@link ServiceBean} instance
   *
   * @return non-null
   */
  public ServiceBean getServiceBean() {
    return (ServiceBean) super.getSource();
  }
}

代码示例来源:origin: spring-projects/spring-batch

@Override
public String toString() {
  return "message=["+message+"], " + super.toString();
}

代码示例来源:origin: de.tudarmstadt.ukp.inception.app/inception-log

default Date getCreated(T aEvent)
{
  if (aEvent instanceof ApplicationEvent) {
    return new Date(((ApplicationEvent) aEvent).getTimestamp());
  }
  else {
    return new Date();
  }
}

代码示例来源:origin: inception-project/inception

default Date getCreated(T aEvent)
{
  if (aEvent instanceof ApplicationEvent) {
    return new Date(((ApplicationEvent) aEvent).getTimestamp());
  }
  else {
    return new Date();
  }
}

代码示例来源:origin: apache/incubator-dubbo

/**
   * Get {@link ServiceBean} instance
   *
   * @return non-null
   */
  public ServiceBean getServiceBean() {
    return (ServiceBean) super.getSource();
  }
}

代码示例来源:origin: spring-projects/spring-batch

@Override
public String toString() {
  return "message=["+message+"], " + super.toString();
}

代码示例来源:origin: spring-projects/spring-security

/**
   * Getters for the <code>Authentication</code> request that caused the event. Also
   * available from <code>super.getSource()</code>.
   *
   * @return the authentication request
   */
  public Authentication getAuthentication() {
    return (Authentication) super.getSource();
  }
}

代码示例来源:origin: cloudfoundry/uaa

@Override
  protected void handleEvent(ApplicationEvent applicationEvent) {
    super.handleEvent(applicationEvent);

    this.events.removeIf(event -> {
      try {
        honeycombEventFactory.createEvent()
            .addField("auditEvent", event.getClass().getSimpleName())
            .addField("eventSource", event.toString())
            .addField("testName", testRunning)
            .send();
      } catch(Exception _) {}
      return true;
    });
  }
}

代码示例来源:origin: org.springframework.security/spring-security-core

/**
   * Getters for the <code>Authentication</code> request that caused the event. Also
   * available from <code>super.getSource()</code>.
   *
   * @return the authentication request
   */
  public Authentication getAuthentication() {
    return (Authentication) super.getSource();
  }
}

代码示例来源:origin: otto-de/edison-microservice

@Override
public String toString() {
  return "StateChangeEvent{" +
      "jobId='" + jobId + '\'' +
      ", jobType='" + jobType + '\'' +
      ", state=" + state +
      ", message='" + message + '\'' +
      "} " + super.toString();
}

代码示例来源:origin: org.springframework.boot/spring-boot

/**
 * Access the source of the event (an {@link WebServer}).
 * @return the embedded web server
 */
@Override
public WebServer getSource() {
  return (WebServer) super.getSource();
}

代码示例来源:origin: org.jasig.portal/uPortal-spring

@Override
  protected void onFilteredApplicationEvent(ApplicationEvent event) {
    if (this.eventLogger.isInfoEnabled()) {
      this.eventLogger.info(event.toString());
    }
  }
}

代码示例来源:origin: spring-projects/spring-data-mongodb

@SuppressWarnings({ "unchecked" })
@Override
public T getSource() {
  return (T) super.getSource();
}

代码示例来源:origin: alien4cloud/alien4cloud

@Override
  public void onApplicationEvent(ApplicationEvent applicationEvent) {
    if (applicationEvent instanceof SessionConnectEvent || applicationEvent instanceof SessionConnectedEvent
        || applicationEvent instanceof SessionSubscribeEvent || applicationEvent instanceof SessionUnsubscribeEvent
        || applicationEvent instanceof SessionDisconnectEvent || applicationEvent instanceof BrokerAvailabilityEvent) {
      log.info(applicationEvent.getClass().getSimpleName() + " " + applicationEvent.toString());
    }
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

public byte[] getSource() {
  return (byte[]) super.getSource();
}

代码示例来源:origin: org.mule.modules/mule-module-spring-extras

public void onApplicationEvent(ApplicationEvent event)
{
  try
  {
    threadPool.execute(new Worker(listener, event));
  }
  catch (RejectedExecutionException e)
  {
    logger.error("Failed to execute worker for event: " + event.toString(), e);
  }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public void onApplicationEvent(ApplicationEvent event) {
  if (event.getSource() == this.source) {
    onApplicationEventInternal(event);
  }
}

代码示例来源:origin: org.mule.modules/mule-module-spring

public void run()
  {
    try
    {
      listener.onApplicationEvent(event);
    }
    catch (Exception e)
    {
      logger.error("Failed to forward event: " + event.toString(), e);
    }
  }
}

代码示例来源:origin: org.springframework/spring-context

@Override
public void onApplicationEvent(ApplicationEvent event) {
  if (event.getSource() == this.source) {
    onApplicationEventInternal(event);
  }
}

代码示例来源:origin: org.mule.modules/mule-module-spring-extras

public void run()
  {
    try
    {
      listener.onApplicationEvent(event);
    }
    catch (Exception e)
    {
      logger.error("Failed to forward event: " + event.toString(), e);
    }
  }
}

相关文章

最新文章

更多