Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,8 +27,10 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
@@ -39,6 +41,7 @@ import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.PayloadApplicationEvent;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
@@ -546,6 +549,14 @@ public class AnnotationDrivenEventListenerTests {
|
||||
assertThat(listener.order, contains("first", "second", "third"));
|
||||
}
|
||||
|
||||
@Test @Ignore // SPR-15122
|
||||
public void listenersReceiveEarlyEvents() {
|
||||
load(EventOnPostConstruct.class, OrderedTestListener.class);
|
||||
OrderedTestListener listener = this.context.getBean(OrderedTestListener.class);
|
||||
|
||||
assertThat(listener.order, contains("first", "second", "third"));
|
||||
}
|
||||
|
||||
|
||||
private void load(Class<?>... classes) {
|
||||
List<Class<?>> allClasses = new ArrayList<>();
|
||||
@@ -936,6 +947,18 @@ public class AnnotationDrivenEventListenerTests {
|
||||
}
|
||||
|
||||
|
||||
static class EventOnPostConstruct {
|
||||
|
||||
@Autowired
|
||||
ApplicationEventPublisher publisher;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
this.publisher.publishEvent("earlyEvent");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static class CustomScope implements org.springframework.beans.factory.config.Scope {
|
||||
|
||||
public boolean active = true;
|
||||
|
||||
Reference in New Issue
Block a user