title: Is it good practice to inject variables in a Utility class?
body: <p>I have the below Utility class in Java.</p>
  
  <pre><code>    public class Utils {
         private static Properties commonProps;
  
         private Utils() {}
  
         private static setCommonProps(Properties commonProps) {
             Utils.commonProps = commonProps;
         }
  
         public static boolean staticMethod1() {
             commonProps.get("xyz");
         }
  
         public static void staticMethod2() {
         }
      }
  </code></pre>
  
  <p>And we initialize "commonProps" with the help of Spring function org.springframework.beans.factory.config.MethodInvokingFactoryBean.</p>
  
  <p>Is there anything wrong in this design of code? Can this have any bad effects?
  Is it a good practice to have such variable initialization for Utility classes?</p>
  
  <p>NOTE: Here "Properties commonProps" is just a placeholder. Any common member that need to be used in this class which has to be injected during startup.</p>