Reputation: 11
How do I control/restrict the instantiation of bean?
Lets say, I have 2 beans
Scopes of the both the bean as singleton & configured inside Spring application context
If A bean gets instantiated then B shouldn't vice-versa if B gets instantiated the A shouldn't.
Upvotes: 0
Views: 35
Reputation: 3134
You can use @Conditional or @Profile. For first annotation you can write a class which will check if your bean exists.
Upvotes: 1