-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Mike Quilleash opened SPR-6211 and commented
I have a spring <beans> with default-destroy-method="destroy". Some of my beans have a destroy() method, some don't.
It looks like, inside the DisposableBeanAdapter the following happens for the beans that do NOT have a destroy() method.
- Construction
- destroyMethodName looked up from bean definition
- destoryMethod looked up from name, gets null
- validates that destroy method can be null (beanDefinition.isEnforceDestroyMethod())
Then on dispose
- destroyMethod is null
- destroyMethodName is not null, tries to look up destroyMethod again, and gets null again
- passes result to invokeCustomDestroyMethod()
- invokeCustomDestroyMethod() throws NPE as destroyMethod is null
Possible solution would be to null out destroyMethodName in the constructor if the method is not found, or perhaps not create the DisposableBeanAdapter at all.
Affects: 3.0 M4
Referenced from: commits 11d9870
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug