本文整理匯總了Java中org.springframework.context.ApplicationEvent.getSource方法的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationEvent.getSource方法的具體用法?Java ApplicationEvent.getSource怎麽用?Java ApplicationEvent.getSource使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.ApplicationEvent
的用法示例。
在下文中一共展示了ApplicationEvent.getSource方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onApplicationEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的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()));
}
}
示例2: onApplicationEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的package包/類
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)
{
publishEvent(((ContextRefreshedEvent) event).getApplicationContext(), Collections.<String, Serializable> emptyMap());
}
}
示例3: multicastEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的package包/類
@Override
public void multicastEvent(ApplicationEvent event)
{
if (event instanceof ContextRefreshedEvent && event.getSource() == this.appContext)
{
this.isApplicationStarted = true;
for (ApplicationEvent queuedEvent : this.queuedEvents)
{
multicastEventInternal(queuedEvent);
}
this.queuedEvents.clear();
multicastEventInternal(event);
}
else if (event instanceof ContextClosedEvent && event.getSource() == this.appContext)
{
this.isApplicationStarted = false;
multicastEventInternal(event);
}
else if (this.isApplicationStarted)
{
multicastEventInternal(event);
}
else
{
this.queuedEvents.add(event);
}
}
示例4: onApplicationEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的package包/類
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event instanceof AbstractAuthenticationFailureEvent) {
if (event.getSource() instanceof AbstractAuthenticationToken) {
AbstractAuthenticationToken token = (AbstractAuthenticationToken) event.getSource();
Object details = token.getDetails();
if (details instanceof WebAuthenticationDetails) {
LOG.info("Login failed from [" + ((WebAuthenticationDetails) details).getRemoteAddress() + "]");
}
}
}
}
示例5: onApplicationEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的package包/類
/**
* {@inheritDoc}
*/
public void onApplicationEvent(ApplicationEvent event)
{
if (this.autoStart && event instanceof ContextRefreshedEvent && event.getSource() == this.parent)
{
this.lock.writeLock().lock();
try
{
start(false, false);
}
catch (Exception e)
{
// Let's log and swallow auto-start exceptions so that they are non-fatal. This means that the system
// can hopefully be brought up to a level where its configuration can be edited and corrected
logger.error("Error auto-starting subsystem", e);
}
finally
{
this.lock.writeLock().unlock();
}
}
else if (event instanceof PropertyBackedBeanStartedEvent)
{
this.lock.writeLock().lock();
try
{
// If we aren't started, reinitialize so that we pick up state changes from the database
switch (this.runtimeState)
{
case PENDING_BROADCAST_START:
case STOPPED:
destroy(false);
// fall through
case UNINITIALIZED:
start(false, false);
}
}
finally
{
this.lock.writeLock().unlock();
}
}
else if (event instanceof PropertyBackedBeanStoppedEvent)
{
this.lock.writeLock().lock();
try
{
// Completely destroy the state so that it will have to be reinitialized should the bean be put back in
// to use by this node
destroy(false);
}
finally
{
this.lock.writeLock().unlock();
}
}
}
示例6: onApplicationEvent
import org.springframework.context.ApplicationEvent; //導入方法依賴的package包/類
@Override
public void onApplicationEvent(ApplicationEvent event) {
if (event.getSource() == this.source) {
onApplicationEventInternal(event);
}
}