I have a static attribute (myDIClass) in a singleton Spring bean class called MySpringBean. The reason for defining myDIClass as static so that I can reference it within the static block.Code:public class MySpringBean { private static MyDIClass myDIClass; // setter for myDIClass static{ // myDIClass is referenced here } }
Also, note that the value of myDIClass is not bound to change e.g., toString()/equals() on it will always be the same (e.g. value as Apple) across the application, accross each and every invocation.
My question:
1. Am I running into any violation by declaring myDICass as static, considering its value will always be the same for all the invocations across the application?


Reply With Quote