Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple Spring IoC Containers

Tags:

spring

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" ?

-DKC

like image 303
DKC Avatar asked Aug 29 '26 11:08

DKC


2 Answers

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.

like image 151
Bozho Avatar answered Aug 31 '26 01:08

Bozho


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

like image 25
neel4soft Avatar answered Aug 31 '26 02:08

neel4soft



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!