Affects: 5.3

Java configuration infers destroy methods, looking for methods named shutdown and close. This is documented, but in a way that is very XML-focused:

You can assign the destroy-method attribute of a element a special (inferred) value, which instructs Spring to automatically detect a public close or shutdown method on the specific bean class. (Any class that implements java.lang.AutoCloseable or java.io.Closeable would therefore match.) You can also set this special (inferred) value on the default-destroy-method attribute of a element to apply this behavior to an entire set of beans (see Default Initialization and Destroy Methods). Note that this is the default behavior with Java configuration.

You have to persevere and read several sentences that are XML-specific to learn that Java configuration has this behavior. I think the inference should be documented more prominently and with a Java-first approach. I think it may even warrant a separate (sub-)section rather than being tucked away in a tip.

Comment From: sbrannen

It's actually documented here.

But that's also a "tip", and it's in a completely different section of that chapter.

So there's certainly room for improvement here.