I work in a Java EE environment in which each application is in its own war file. In WEB-INF / lib of each application war file there is a common bank that is used by all applications. This common jar contains several singletones, which are accessed by many points in the code. Because of the boundaries of war files, each application has its own instances of Singletons. This is how we work today, since we want to configure individual singletones differently in each application.
Now we are moving to the OSGi environment where this solution will no longer work, since each bundle has its own class loader, so if I try to access MySingleton, which is in the "common.jar" bundle from the "appA.jar" package "or from the package" appB.jar "I will get the same instance.
Remember that I "want" another instance of a singleton package. (paradoxically)
Now I understand that the ideal solution would be to fix the code so as not to rely on these singletones, however, due to the limited schedule, I was wondering if you guys can offer some kind of migration solution that would allow me to use bundle- so that each of them could be configured for each package.
Ido
source share