Closed
Description
Hello!
I have simple interface like this:
public interface ITest
{
}
and the simple event:
public class TestEvent<T extends ITest> extends ApplicationEvent
{
public TestEvent(Object source)
{
super(source);
}
}
and two listeners:
@Component
public class MethodListener
{
@EventListener
public void handleTestEvent(TestEvent<ITest> iTest)
{
System.out.println(this.getClass() + " DONE!");
}
}
@Component
public class SimpleTestListener implements ApplicationListener<TestEvent<ITest>>
{
@Override
public void onApplicationEvent(TestEvent<ITest> event)
{
System.out.println(this.getClass() + " DONE!");
}
}
and when i trying to send an event via the spring context like this:
public class MySpringApplication
{
public static void main(String[] args)
{
ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class);
context.publishEvent(new TestEvent<>(""));
}
}
i have different result in depends on the version Spring. When i use Spring 6.2 i can see in the log this:
class ... MethodListener DONE!
when i use Spring 6.1.15 i see both results:
class ...SimpleTestListener DONE!
class ...MethodListener DONE!
I guess it's a bug.