Java Reference
In-Depth Information
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=" http://www.springframework.org/schema/beans"
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"
xmlns:context=" http://www.springframework.org/schema/context"
xsi:schemaLocation=" http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/integration
">
<bean id="customerService"
class="com.apress.springenterpriserecipes.distributedspring.terracotta.customerconsole.servi
ce.CustomerServiceImpl"/>
<bean id="customerConsole"
class="com.apress.springenterpriserecipes.distributedspring.terracotta.customerconsole.view.
CustomerConsole">
<property name="customerService" ref="customerService"/>
</bean>
</beans>
If we take a look at the revised ( tc-customerconsole-w-spring.xml ) example from the last recipe,
the immediate benefit is apparent: it's much more concise! We've ripped out the application element
entirely. Instead, we tell Terracotta about our Spring application context in the path element. It knows to
consult that for information. Then, in the bean element, we specify which bean in the context to cluster:
<application>
<spring>
<jee-application name="*">
<application-contexts>
<application-context>
<paths>
<path>customerconsole-context.xml</path>
</paths>
<beans>
<bean name="customerService"/>
</beans>
</application-context>
</application-contexts>
<locks>
<autolock>
<method-expression>*
com.apress.springenterpriserecipes.distributedspring.terracotta.customerconsole.
service.CustomerServiceImpl.*(..)
</method-expression>
Search WWH ::




Custom Search