Is it possible so set jndiEnvironment at runtime with for a org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean bean ?
Because we don't want to set URL, LOGIN and PASSWORD in our Spring context definitions.
Thx,
-emmanuel
Is it possible so set jndiEnvironment at runtime with for a org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean bean ?
Because we don't want to set URL, LOGIN and PASSWORD in our Spring context definitions.
Thx,
-emmanuel
If I understood you correctly you should be able to do something like this..
Code:<beans> <bean id="myComponent" lazy-init="true" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean"> <property name="jndiName"> <value>SimpleEJB</value> </property> <property name="jndiEnvironment"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop> <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop> <prop key="java.naming.provider.url">jnp://localhost:1099</prop> </props> </property> <property name="businessInterface"> <value>com.codethought.springejb.services.MyComponent</value> </property> </bean> </beans>
Emmanuel,
You can subclass java.util.Properties and use a constructor that fill in the parameters, then use this class to initialize your SimpleRemoteStatelessSessionProxyFactoryBean:
If you need to define some properties outside of your class (java.naming.factory.initial...), you can use a setter methodCode:<property name="jndiEnvironment"> <bean class="myEnvironmentClass" /> </property>
Of course you will have to recompile your class whenever the user / password / url change. I hope you will consider a better alternative.Code:public void setSomeProperties(Properties props) { puttAll(props); } <property name="jndiEnvironment"> <bean class="myEnvironmentClass"> <props> <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop> <prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces</prop> </props> </bean> </property>