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 receive 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 several 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 constructed we should check if it already exist in the container, in that case assign it instead the constructed one. Something like JPA L2 cache, but in client side.
Is there any implementation about it?
Or maybe i should use another approach?