|
|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
package org.springframework.context.event; |
|
|
|
package org.springframework.context.event; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.Serializable; |
|
|
|
import java.lang.annotation.ElementType; |
|
|
|
import java.lang.annotation.ElementType; |
|
|
|
import java.lang.annotation.Retention; |
|
|
|
import java.lang.annotation.Retention; |
|
|
|
import java.lang.annotation.RetentionPolicy; |
|
|
|
import java.lang.annotation.RetentionPolicy; |
|
|
|
@ -105,8 +106,9 @@ class AnnotationDrivenEventListenerTests { |
|
|
|
this.eventCollector.assertTotalEventsCount(1); |
|
|
|
this.eventCollector.assertTotalEventsCount(1); |
|
|
|
|
|
|
|
|
|
|
|
this.eventCollector.clear(); |
|
|
|
this.eventCollector.clear(); |
|
|
|
this.context.publishEvent(event); |
|
|
|
TestEvent otherEvent = new TestEvent(this, Integer.valueOf(1)); |
|
|
|
this.eventCollector.assertEvent(listener, event); |
|
|
|
this.context.publishEvent(otherEvent); |
|
|
|
|
|
|
|
this.eventCollector.assertEvent(listener, otherEvent); |
|
|
|
this.eventCollector.assertTotalEventsCount(1); |
|
|
|
this.eventCollector.assertTotalEventsCount(1); |
|
|
|
|
|
|
|
|
|
|
|
context.getBean(ApplicationEventMulticaster.class).removeApplicationListeners(l -> |
|
|
|
context.getBean(ApplicationEventMulticaster.class).removeApplicationListeners(l -> |
|
|
|
@ -742,6 +744,11 @@ class AnnotationDrivenEventListenerTests { |
|
|
|
public void handleString(String content) { |
|
|
|
public void handleString(String content) { |
|
|
|
collectEvent(content); |
|
|
|
collectEvent(content); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventListener({Boolean.class, Integer.class}) |
|
|
|
|
|
|
|
public void handleBooleanOrInteger(Serializable content) { |
|
|
|
|
|
|
|
collectEvent(content); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1009,6 +1016,8 @@ class AnnotationDrivenEventListenerTests { |
|
|
|
|
|
|
|
|
|
|
|
void handleString(String payload); |
|
|
|
void handleString(String payload); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void handleBooleanOrInteger(Serializable content); |
|
|
|
|
|
|
|
|
|
|
|
void handleTimestamp(Long timestamp); |
|
|
|
void handleTimestamp(Long timestamp); |
|
|
|
|
|
|
|
|
|
|
|
void handleRatio(Double ratio); |
|
|
|
void handleRatio(Double ratio); |
|
|
|
@ -1031,6 +1040,12 @@ class AnnotationDrivenEventListenerTests { |
|
|
|
super.handleString(payload); |
|
|
|
super.handleString(payload); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@EventListener({Boolean.class, Integer.class}) |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void handleBooleanOrInteger(Serializable content) { |
|
|
|
|
|
|
|
super.handleBooleanOrInteger(content); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ConditionalEvent("#root.event.timestamp > #p0") |
|
|
|
@ConditionalEvent("#root.event.timestamp > #p0") |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void handleTimestamp(Long timestamp) { |
|
|
|
public void handleTimestamp(Long timestamp) { |
|
|
|
|