Skip to content

Commit e7b77cb

Browse files
committed
Drop legacy DisposableBean declaration on AbstractApplicationContext
Issue: SPR-15154
1 parent 6d55b3a commit e7b77cb

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

spring-context-support/src/test/java/org/springframework/scheduling/quartz/QuartzSchedulerLifecycleTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2009 the original author or authors.
2+
* Copyright 2002-2017 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,25 +30,25 @@
3030
*/
3131
public class QuartzSchedulerLifecycleTests {
3232

33-
@Test // SPR-6354
33+
@Test // SPR-6354
3434
public void destroyLazyInitSchedulerWithDefaultShutdownOrderDoesNotHang() {
3535
AbstractApplicationContext context = new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", this.getClass());
3636
assertNotNull(context.getBean("lazyInitSchedulerWithDefaultShutdownOrder"));
3737
StopWatch sw = new StopWatch();
3838
sw.start("lazyScheduler");
39-
context.destroy();
39+
context.close();
4040
sw.stop();
4141
assertTrue("Quartz Scheduler with lazy-init is hanging on destruction: " +
4242
sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 500);
4343
}
4444

45-
@Test // SPR-6354
45+
@Test // SPR-6354
4646
public void destroyLazyInitSchedulerWithCustomShutdownOrderDoesNotHang() {
4747
AbstractApplicationContext context = new ClassPathXmlApplicationContext("quartzSchedulerLifecycleTests.xml", this.getClass());
4848
assertNotNull(context.getBean("lazyInitSchedulerWithCustomShutdownOrder"));
4949
StopWatch sw = new StopWatch();
5050
sw.start("lazyScheduler");
51-
context.destroy();
51+
context.close();
5252
sw.stop();
5353
assertTrue("Quartz Scheduler with lazy-init is hanging on destruction: " +
5454
sw.getTotalTimeMillis(), sw.getTotalTimeMillis() < 500);

spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.springframework.beans.BeansException;
3535
import org.springframework.beans.CachedIntrospectionResults;
3636
import org.springframework.beans.factory.BeanFactory;
37-
import org.springframework.beans.factory.DisposableBean;
3837
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
3938
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
4039
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
@@ -124,7 +123,7 @@
124123
* @see org.springframework.context.MessageSource
125124
*/
126125
public abstract class AbstractApplicationContext extends DefaultResourceLoader
127-
implements ConfigurableApplicationContext, DisposableBean {
126+
implements ConfigurableApplicationContext {
128127

129128
/**
130129
* Name of the MessageSource bean in the factory.
@@ -940,12 +939,13 @@ public void run() {
940939
}
941940

942941
/**
943-
* DisposableBean callback for destruction of this instance.
942+
* Callback for destruction of this instance, originally attached
943+
* to a {@code DisposableBean} implementation (not anymore in 5.0).
944944
* <p>The {@link #close()} method is the native way to shut down
945945
* an ApplicationContext, which this method simply delegates to.
946-
* @see #close()
946+
* @deprecated as of Spring Framework 5.0, in favor of {@link #close()}
947947
*/
948-
@Override
948+
@Deprecated
949949
public void destroy() {
950950
close();
951951
}

0 commit comments

Comments
 (0)