According to Spring documentation when a bean is scoped as \"prototype\" spring does not manage the complete lifecycle of its objects. More specifically the destruction life
The only clean way to terminate prototype-scoped bean is to explicitly call some of its "destroy"-methods to dispose resources. You can also use Phantom References. Here is more info on different types of references.
What you're looking for is the DestructionAwareBeanPostProcessor, it's a sub-interface of BeanPostProcessor.
You could create a new implementation of that interface yourself, or use one of its implementing classes, like CommonAnnotationBeanProcessor.