Java Reference
In-Depth Information
<property name=" defaultObject" ref="uwrbusinessPOJO" />
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">
org.jnp.interfaces.NamingContextFactory
</prop>
<prop key="java.naming.provider.url"> jnp://localhost:1099</prop>
<prop key=" java.naming.factory.url.pkgs">org.jboss.naming.client</prop>
</props>
</property>
</bean>
</beans>
It must be noted that the JndiObjectFactoryBean is a convenient way to look up JNDI
objects. But the recommended approach is to use a proxy factory bean that effectively
combines the service locator with dependency injection. You will learn about this strat-
egy in connection with the Business Delegate pattern.
Consequences
Benefits
• The Service Locator pattern abstracts the complex lookup mechanism associated
with service objects. This adds flexibility because the service clients are freed from
the lookup code.
• JNDI lookup is achieved by mere configuration with the Spring Framework.
• Performance is improved by the caching behavior of the Spring-based service
locator.
• Improved testability of service objects. With Spring, it is now possible to test POJO
business components outside the container without any alteration of the applica-
tion code base.
• It's easy to externalize service locator configuration.
 
Search WWH ::




Custom Search