DisposableBeanAdapter
historically calls everything other than DisposableBean.destroy()
via reflection, including a close()
method derived from the standard Closeable
/AutoCloseable
interface. This is partly due to AutoCloseable
being Java 7+ and therefore only reflectively available on the Spring Framework 4.x baseline, partly also due to such a close()
invocation being suppressible by the user through specifying an empty destroy method name. While the latter effect is worth preserving, the former can be replaced with a direct invocation after an AutoCloseable
cast now. In addition to being more efficient on the JVM, this also avoids reflection metadata having to be available in a GraalVM native image just for that purpose.