title: How to set global config/variable in Spring MVC 4?
body: <p>I am using Spring MVC 4.1.4</p>
  
  <p>I have some global settings to share in whole application</p>
  
  <p>These setting should only be loaded when start the server</p>
  
  <p>I know I can use context-param</p>
  
  <pre><code>&lt;context-param&gt;
      &lt;param-name&gt;configA&lt;/param-name&gt;
      &lt;param-value&gt;valueA&lt;/param-value&gt;
  &lt;/context-param&gt;
  &lt;context-param&gt;
      &lt;param-name&gt;configB&lt;/param-name&gt;
      &lt;param-value&gt;valueB&lt;/param-value&gt;
  &lt;/context-param&gt;
  </code></pre>
  
  <p>But I want store some complex object, like this</p>
  
  <pre><code>HashMap myConfig = new HashMap();
  
  String[] cfgB={"b1", "b2"};
  
  HashMap&lt;String, String&gt; cfgC=new HashMap&lt;String, String&gt;();
  cfgC.put("C1", "1");
  cfgC.put("C2", "2");
  
  MyConfigD cfgD = new MyConfigD();
  
  myConfig.put("configA", "A");
  myConfig.put("configB",cfgB);
  myConfig.put("configC",cfgC);
  myConfig.put("configD",cfgD);
  </code></pre>
  
  <p>context-param is not possible to do that, what else I can use in Java or Spring?</p>