Tutorial :Multiple Spring IoC Containers


Is it possible to have two IoC containers in one JVM ? If so, is there a way to use objects created in one container in other using "@Configurable" ?



There can be multiple contexts. They can be totally separate, and they can have a parent-child relation. In the latter case, they behave as if they are one. In the former - no, you can't.


you can not have more than one ioc container but you can configure and use more than one type of ioc configuration, say using setter method , constructor arguments and autowored together

here is a nice post to show how to do it in a single application

Spring IOC

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »