Issue Details (XML | Word | Printable)

Key: SPR-3364
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Juergen Hoeller
Reporter: Andy Piper
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Spring Framework

Provide API for removing bean definitions

Created: 12/Apr/07 07:48 AM   Updated: 18/Jul/07 02:26 AM
Component/s: SpringCORE
Affects Version/s: 2.0.4
Fix Version/s: 2.1 M3

Time Tracking:
Not Specified


 Description  « Hide
BeanDefinitionRegistry has no API for doing this, it would be useful if there were one.

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Taras Tielkes added a comment - 18/Apr/07 02:54 PM
What would be the use?

At the moment there's still some resemblance between the beans xml I can read and the runtime model. Custom decorators can replace some definitions, and new definitions can be added of course.

When you open the gates to full mutability of the model, well...things won't be so simple anymore (as if they were now... :-) )

Juergen Hoeller added a comment - 17/Jul/07 05:51 PM
I don't see a need for this either. If you know you don't want a bean definition, then don't register it in the first place ;-)

Seriously, there should be no need for this in standard scenarios. What use case do you have in mind there, Andy?

Juergen

Andy Piper added a comment - 17/Jul/07 06:43 PM
I would like to modify the factory contents dynamically. A lot of this works already - e.g. registering a bean definition and then calling getBean(). I would like to do the opposite, rather than having to register a dummy bean.

Juergen Hoeller added a comment - 18/Jul/07 02:26 AM
OK, since it doesn't hurt to make such a "removeBeanDefinition" method available, I've added it for 2.1 M3 already. This operation is effectively doing what "registerBeanDefinition" does in case of overriding an existing definition, just that it doesn't register a new definition.

Use it with care :-)

Juergen