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