私は古いSpring XML設定を持っています。 WebSphere 8で<jee:jndi-lookup>をWebsphere環境のSpring JavaConfigに変換する方法
<jee:jndi-lookup jndi-name="ree/configuration" cache="true" id="re-properties-config" />
私は、JNDI名「REE /設定」の「リソース環境プロバイダー」と「リソース環境エントリー」を持っています。 Referenceablesクラスはjava.util.Propertiesです。
xml設定ですべて動作します。プロパティー・オブジェクトにマップされたWebSphereの「リソース環境エントリー」
私はSpring JavaConfigに移行します。 最適なソリューションは何ですか?
私はこれ試してみてください。
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;
}
を、それはClassCastExceptionが発生して失敗しました。 javax.naming.Referenceのはjava.util.Properties
この解決方法もあります。私はもっと快適な何かがあると思った:-) – UKoehler
OK。提案された答えが実際にあなたのために働くことを知ってうれしい。 – Sampada