title: How convert <jee:jndi-lookup> to Spring JavaConfig in a Websphere Environment
body: <p>I have an old Spring xml config.</p>
  
  <pre><code>&lt;jee:jndi-lookup jndi-name="ree/configuration" cache="true" id="re-properties-config" /&gt;
  </code></pre>
  
  <p>In the WebSphere 8 i have a "Resource Environment Providers" and a "Resource environment entry" under the JNDI name "ree/configuration". The  Referenceables class is java.util.Properties.</p>
  
  <p>With xml config everything works. "Resource environment entry" from WebSphere mapped in a Properties Object.</p>
  
  <p>Now i want migrate to Spring JavaConfig.
  What is the best solution?</p>
  
  <p>I try this: </p>
  
  <pre><code>private static Properties jndiProperties() {
      Properties properties = null;
      JndiTemplate jndi = new JndiTemplate();
      try {
          properties = (Properties)jndi.lookup("ree/configuration");
          LOG.info("JNDI Properties loaded: " + properties);
      } catch (NamingException e) {
          LOG.error("NamingException for ree/configuration", e);
      }
      return properties;
  }
  </code></pre>
  
  <p>but it failed with a ClassCastException. javax.naming.Reference cannot cast to java.util.Properties    </p>