This content has been marked as final.
Show 3 replies
-
1. Re: How to inject the result of a JNDI lookup?
swruch Sep 9, 2009 2:27 PM (in response to swruch)Sorry, forgot to quote the XML snippet.
"swruch" wrote:
Hopefully I haven't missed something obvious, I've been searching for a few hours for the answer to this, to no avail...
In Spring, I would do this:
<property name="connectionFactory"> <bean class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName"> <value>java:comp/env/jms/ConnectionFactory</value> </property> </bean> </property>
How can I do this in the MC? -
2. Re: How to inject the result of a JNDI lookup?
alesj Sep 10, 2009 7:33 AM (in response to swruch)Interestingly, it's exactly the same.
See any -jboss-beans.xml, and just copy your snippet properly.
Or you wanna know how to pull something out of JNDI?
There is JNDIKernelRegistryPlugin that does that for you.
You must simply add it as a bean.
Note: it adds some performance penalty as once it's installed, it's included in every bean lookup -
3. Re: How to inject the result of a JNDI lookup?
swruch Sep 10, 2009 8:35 AM (in response to swruch)Thanks, I was able to get it working with the JNDIKernelRegistryPlugin. I'm not using Spring here, so I prefer the native mechanism.
For those who come looking for a solution, here's what it looks like. In this case, I'm injecting a DataSource that is bound as "java:/MySqlDS":<bean name="JndiKernelRegistryPlugin" class="org.jboss.kernel.plugins.dependency.JNDIKernelRegistryPlugin"/> <bean name="..." class="..."> <property name="dataSource"> <inject bean="java:MySqlDS"/> </property>