Reputation: 3433
How many BeanFactories can a spring application can have? I got this doubt when i see the source code of a spring based web application where they used an xml based configuration for a set of beans as well as annotation based configuration for the rest. Is this produce multiple bean factories or single at startup?
Upvotes: 0
Views: 179
Reputation: 3148
Definitely need more information on config to tell for sure.
The easiest way to find out is by using their visibility. Try to inject beans declared in the xml configuration in one of the beans using annotations, if it works they are using the same bean factory -
The probabilities are that it is the case. It is not unusual to have a mix of bean and annotation based configuration. Some people prefer to move configuration which they know for sure will not require to the flexibility of switching in a config file into beans. This reduces a lot of clutter in the xml configuration.
Upvotes: 1