|
37 | 37 | import org.mockito.InOrder;
|
38 | 38 |
|
39 | 39 | import org.springframework.beans.MutablePropertyValues;
|
40 |
| -import org.springframework.beans.factory.DisposableBean; |
41 | 40 | import org.springframework.beans.factory.config.BeanDefinition;
|
42 | 41 | import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
43 | 42 | import org.springframework.beans.factory.config.ConstructorArgumentValues;
|
44 | 43 | import org.springframework.beans.factory.config.Scope;
|
45 |
| -import org.springframework.beans.factory.support.BeanDefinitionBuilder; |
46 | 44 | import org.springframework.beans.factory.support.RootBeanDefinition;
|
47 |
| -import org.springframework.boot.context.embedded.MockEmbeddedServletContainerFactory.MockEmbeddedServletContainer; |
48 | 45 | import org.springframework.context.ApplicationContextException;
|
49 | 46 | import org.springframework.context.ApplicationListener;
|
50 | 47 | import org.springframework.context.support.AbstractApplicationContext;
|
|
58 | 55 |
|
59 | 56 | import static org.hamcrest.Matchers.equalTo;
|
60 | 57 | import static org.hamcrest.Matchers.instanceOf;
|
61 |
| -import static org.hamcrest.Matchers.is; |
62 | 58 | import static org.hamcrest.Matchers.nullValue;
|
63 | 59 | import static org.hamcrest.Matchers.sameInstance;
|
64 | 60 | import static org.junit.Assert.assertEquals;
|
@@ -434,22 +430,6 @@ public void doesNotReplaceExistingScopes() throws Exception { // gh-2082
|
434 | 430 | sameInstance(scope));
|
435 | 431 | }
|
436 | 432 |
|
437 |
| - @Test |
438 |
| - public void containerIsStoppedBeforeContextIsClosed() { |
439 |
| - addEmbeddedServletContainerFactoryBean(); |
440 |
| - this.context.registerBeanDefinition("shutdownOrderingValidator", |
441 |
| - BeanDefinitionBuilder.rootBeanDefinition(ShutdownOrderingValidator.class) |
442 |
| - .addConstructorArgReference("embeddedServletContainerFactory") |
443 |
| - .getBeanDefinition()); |
444 |
| - this.context.refresh(); |
445 |
| - ShutdownOrderingValidator validator = this.context |
446 |
| - .getBean(ShutdownOrderingValidator.class); |
447 |
| - this.context.close(); |
448 |
| - assertThat(validator.destroyed, is(true)); |
449 |
| - assertThat(validator.containerStoppedFirst, is(true)); |
450 |
| - |
451 |
| - } |
452 |
| - |
453 | 433 | private void addEmbeddedServletContainerFactoryBean() {
|
454 | 434 | this.context.registerBeanDefinition("embeddedServletContainerFactory",
|
455 | 435 | new RootBeanDefinition(MockEmbeddedServletContainerFactory.class));
|
@@ -499,25 +479,4 @@ public void doFilter(ServletRequest request, ServletResponse response,
|
499 | 479 |
|
500 | 480 | }
|
501 | 481 |
|
502 |
| - protected static class ShutdownOrderingValidator implements DisposableBean { |
503 |
| - |
504 |
| - private final MockEmbeddedServletContainer servletContainer; |
505 |
| - |
506 |
| - private boolean destroyed = false; |
507 |
| - |
508 |
| - private boolean containerStoppedFirst = false; |
509 |
| - |
510 |
| - ShutdownOrderingValidator( |
511 |
| - MockEmbeddedServletContainerFactory servletContainerFactory) { |
512 |
| - this.servletContainer = servletContainerFactory.getContainer(); |
513 |
| - } |
514 |
| - |
515 |
| - @Override |
516 |
| - public void destroy() { |
517 |
| - this.destroyed = true; |
518 |
| - this.containerStoppedFirst = this.servletContainer.isStopped(); |
519 |
| - } |
520 |
| - |
521 |
| - } |
522 |
| - |
523 | 482 | }
|
0 commit comments