Java 5 Closeable and Java 7 AutoCloseable automatically detected as destroy methods

Also, @Bean destroy method inference not applying for DisposableBean implementers anymore (avoiding double destruction).

Issue: SPR-10034
This commit is contained in:
Juergen Hoeller
2012-11-26 22:05:29 +01:00
committed by unknown
parent 5cb1930550
commit 9c6aa3e43b
5 changed files with 111 additions and 43 deletions

View File

@@ -435,15 +435,21 @@
The name of the custom initialization method to invoke after setting
bean properties. The method must have no arguments, but may throw any
exception.
This is an alternative to implementing Spring's InitializingBean
interface or marking a method with the PostConstruct annotation.
]]></xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="destroy-method" type="xsd:string">
<xsd:annotation>
<xsd:documentation><![CDATA[
The name of the custom destroy method to invoke on bean factory
shutdown. The method must have no arguments, but may throw any
exception.
The name of the custom destroy method to invoke on bean factory shutdown.
The method must have no arguments, but may throw any exception.
This is an alternative to implementing Spring's DisposableBean
interface or the standard Java Closeable/AutoCloseable interface,
or marking a method with the PreDestroy annotation.
Note: Only invoked on beans whose lifecycle is under the full
control of the factory - which is always the case for singletons,