|
|
Mapping JNDI values to Spring beans
Environment: Spring 2.5 with Websphere 6.0
We have configured many JNDI attributes through the websphere admin console. What is the best and suggested way to map JNDI attributes to a bean property?
Let's say we have the below class and need to map the boolean quot;jndiFlagquot; attribute to JNDI name quot;jndiFlagquot; (the value would be true or false)Code:
public class TestClass {
private boolean jndiFlag;
public void setJndiFlag(boolean jndiFlag) {
this.jndiFlag = jndiFlag;
}
}
Thanks much.
Any help or insights would be highly helpful. Thanks.
Look at JndiObjectFactoryBean:
Code:
lt;bean id=quot;dataSourcequot; class=quot;org..jndi.JndiObjectFactoryBeanquot;gt; lt;property name=quot;jndiNamequot; value=quot;java efaultDSquot;/gt;
lt;/beangt;
Code: lt;bean id=quot;testBeanquot; class=quot;com.example.TestClassquot;gt; lt;property name=quot;jndiFlagquot;gt;lt;bean id=quot;dataSourcequot; class=quot;org..jndi.JndiObjectFactoryBeanquot;gt; lt;property name=quot;jndiNamequot; value=quot;java:JndiFlagquot;/gt;lt;/beangt; lt;/propertygt; lt;/beangt; |
|