Modify to use the ConfigurableApplicationContext in reference document
Issue: SPR-13000
This commit is contained in:
parent
1722fa6678
commit
7926dea352
|
@ -3212,19 +3212,19 @@ singleton beans so that all resources are released. Of course, you must still co
|
|||
and implement these destroy callbacks correctly.
|
||||
|
||||
To register a shutdown hook, you call the `registerShutdownHook()` method that is
|
||||
declared on the `AbstractApplicationContext` class:
|
||||
declared on the `ConfigurableApplicationContext` interface:
|
||||
|
||||
[source,java,indent=0]
|
||||
[subs="verbatim,quotes"]
|
||||
----
|
||||
import org.springframework.context.support.AbstractApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
public final class Boot {
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
|
||||
AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
|
||||
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
|
||||
new String []{"beans.xml"});
|
||||
|
||||
// add a shutdown hook for the above context...
|
||||
|
|
Loading…
Reference in New Issue