Java Reference
In-Depth Information
<jee:jndi-lookup id="uwrSlsbLocalHome"
cache="false"
lookup-on-startup="false"
jndi-name="UnderwritingBeanLocal"
proxy-interface="com.apress.einsure.business. å
ejbfacade.UnderwritingLocalHome"
/>
<jee:jndi-lookup id="uwrSlsbRemoteHome" jndi-name=" UnderwritingBeanRemote ">
<!-- newline-separated, key-value pairs for the environment -->
<jee:environment>
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url= jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming.client
</jee:environment>
</jee:jndi-lookup>
</beans>
Another important aspect of the JndiObjectFactoryBean is the support for unit testing.
It makes it easy to test components out of the container. You can do this by setting the
defaultObject property. It is the fallback object, in case the JNDI service or JNDI bound
objects are unavailable. Listing 4-11 shows how to use the fallback object.
Listing 4-11. insurance-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
>
<!- - Other beans - ->
<bean name="uwrbusinessPOJO"
class="com.apress.einsure.business.UwrBusinessServiceImpl"
<bean name="uwrSlsbHome"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="uwrbusinessslsb" />
 
Search WWH ::




Custom Search