Java Reference
In-Depth Information
<bean name="underwritingBusinessDelegate"
class="com.apress.insurance.view.delegate.UnderWritingBusinessDelegate">
<property name="underWritingHome" ref="uwrSlsbHome" />
</bean>
<bean name="uwrSlsbHome"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="uwrbusinessslsb" />
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">
weblogic.jndi.WLInitialContextFactory
</prop>
<prop key="java.naming.provider.url">
t3://localhost:7001
</prop>
</props>
</property>
</bean>
</beans>
You can use Spring's property placeholder feature to further externalize the
configuration. In this strategy, you replace the values of the different properties with
placeholders. Then you move the values to an external properties file. It is easy to change
the environment-specific values in the properties file and still keep the Spring XML con-
figuration unaffected. For a detailed treatment of Spring's property placeholder support,
you can refer to http://static.springframework.org/spring/docs/2.5.x/reference/
beans.html#beans-factory-placeholderconfigurer .
So, with the Spring Framework, it is possible to set up a configurable service locator
in no time.
Now to support a different application server, you just need to alter the configuration
file. The code shown in Listing 4-4 makes it possible to look up the same EJB deployed on
a JBoss server.
Listing 4-4. insurance-servlet.xml for JBoss
<?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
 
Search WWH ::




Custom Search