GH-1461: added early tests for event type hierarchy support
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
package com.example.events.demo;
|
||||
|
||||
public class SpecializedCustomEvent extends CustomEvent {
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.example.events.demo;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class SpecializedCustomEventPublisher {
|
||||
|
||||
private ApplicationEventPublisher publisher;
|
||||
|
||||
public SpecializedCustomEventPublisher(ApplicationEventPublisher publisher) {
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
public void foo() {
|
||||
this.publisher.publishEvent(new SpecializedCustomEvent());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.events.demo;
|
||||
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -15,5 +16,18 @@ public class TestEventsIndexingApplication {
|
||||
public EventListenerPerInterfaceAndBeanMethod listenerBean() {
|
||||
return new EventListenerPerInterfaceAndBeanMethod();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner runner(CustomEventPublisher pub, SpecializedCustomEventPublisher specialPub) {
|
||||
return new CommandLineRunner() {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
System.out.println("RUN!!!");
|
||||
pub.foo();
|
||||
specialPub.foo();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user