Is Enum a wide, single engine JVM?

I have several wars deployed at the pier. Initially, I had a singleton class, but the problem was that it was initialized in both wars. Therefore, I am trying to make singleton as enum. Is there any way to make JVM wide singleton?

+4
source share
1 answer

You cannot impose it. Your singlets will be class specific, and since your applications can define multiple class loaders, you will be disappointed.

+8
source

Source: https://habr.com/ru/post/1437362/


All Articles