Java Reference
In-Depth Information
<bean id="postageService"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">
org.apache.openejb.client.RemoteInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
</prop>
</props>
</property>
<property name="jndiName" value="PostageServiceBeanRemote" />
</bean>
<bean id="frontDesk"
class="com.apress.springenterpriserecipes.post.FrontDeskImpl">
<property name="postageService" ref="postageService" />
</bean>
</beans>
You can configure the JNDI details for this factory bean in the
jndiEnvironment
and
jndiName
properties. Then you can inject this proxy into
FrontDeskImpl
in the same way as a normal bean.
In Spring, JNDI objects can also be defined using the
<jee:jndi-lookup>
element in the
jee
schema.
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="
http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
<jee:jndi-lookup id="postageService"
jndi-name="PostageServiceBeanRemote">
<jee:environment>
java.naming.factory.initial=
➥
org.apache.openejb.client.RemoteInitialContextFactory
java.naming.provider.url=
ejbd://localhost:4201
</jee:environment>
</jee:jndi-lookup>
...
</beans>
Search WWH ::
Custom Search