Skip to content

Disallow destroy-method when scope is prototype [SPR-6660] #11326

Closed
@spring-projects-issues

Description

@spring-projects-issues

Kenny MacLeod opened SPR-6660 and commented

Having recently encountered an obscure bug where a bean definition had both scope="prototype" and destroy-method specified, I'd like to suggest that when the bean scope is "prototype", the bean definition is not allowed to also specify destroy-method, since it will never be invoked.

Ideally, this would also apply to @PreDestroy-annotated bean classes, throwing an exception when the bean definition is parsed, but that might be a step too far.


Affects: 3.0 GA

Issue Links:

1 votes, 2 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently applytype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions