There is any open source generic bean container?
Let me explain the scenario.
I am working in a Java EE project, and we are using a Swing client. We are using Json to serialize objects. In client side we can recieve a Json message representing a List. Sometimes some A instances can be the same object, but actually for 2 instances of A that are the same object we construct 2 beans that are equals between them but aren't the same instance. This give us some problems: memory overhead, changes made to one instance don't update the other one, ...
What i think we need is a container that can make instance wiring, when a new instance is contructed we should check if it already exist in the container, in that case assign it instead the constructed one. Somethig like JPA L2 cache, but in client side.
Is there any implementation about it? Or maybe i should use another approach?