|
Spring Framework example source code file (declarativeServices.xml)
The Spring Framework declarativeServices.xml source code<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN" "http://www.springframework.org/dtd/spring-beans-2.0.dtd"> <beans> <description> Generic auto-proxy definitions enabling declarative transaction management, based on Commons Attributes attributes. The application context must define a PlatformTransactionManager bean with name "transactionManager" (the bean name can be adapted in the corresponding bean reference below). This file is generic, and not specific to JPetStore. You can use it unchanged as an application context definition file for your own applications to get attribute-driven declarative transaction management. The power of this approach is more apparent when you have many transactional business objects, not just one as in this simple application. Add more Advisor definitions if you want, for additional declarative services. Advisors are detected by type: therefore, no explicit references are necessary. </description> <!-- This bean is a post-processor that will automatically apply relevant advisors to any bean in child factories. --> <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/> <!-- AOP advisor that will provide declarative transaction management based on attributes. It's possible to add arbitrary custom Advisor implementations as well, and they will also be evaluated and applied automatically. --> <bean class="org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor"> <property name="transactionInterceptor" ref="transactionInterceptor"/> </bean> <!-- Transaction interceptor to use for auto-proxy creation. Transaction attributes will be read in from class-level metadata. --> <bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"> <property name="transactionManager" ref="transactionManager"/> <property name="transactionAttributeSource"> <bean class="org.springframework.transaction.interceptor.AttributesTransactionAttributeSource"> <property name="attributes" ref="attributes"/> </bean> </property> </bean> <!-- Commons Attributes Attributes implementation. Replace with another implementation of org.springframework.metadata.Attributes to source attributes from a different source. --> <bean id="attributes" class="org.springframework.metadata.commons.CommonsAttributes"/> </beans> Other Spring Framework examples (source code examples)Here is a short list of links related to this Spring Framework declarativeServices.xml source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.