<?xml version= "1.0" encoding= "UTF-8"?>
<beans
Default-autowire= "ByName"
Default-lazy-init= "true"
Xmlns= "Http://www.springframework.org/schema/beans"
Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
xmlns:p= "http://www.springframework.org/schema/p"
xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
xmlns:tx= "Http://www.springframework.org/schema/tx"
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/aop
Http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
Http://www.springframework.org/schema/tx
Http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
Http://www.springframework.org/schema/context
Http://www.springframework.org/schema/context/spring-context-3.0.xsd
">
<!--open annotation configuration-->
<context:annotation-config/>
<!--component scanning of the specified package-->
<context:component-scan base-package= "Com.lun"/>
<!--linked database-->
<bean id= "DataSource" class= "Org.apache.commons.dbcp.BasicDataSource" >
<property name= "Driverclassname" value= "Oracle.jdbc.driver.OracleDriver" ></property>
<property name= "url" value= "JDBC:ORACLE:THIN:@127.0.0.1:1521:ORCL" ></property>
<property name= "username" value= "LUN" ></property>
<property name= "password" value= "123" ></property>
</bean>
<!--configuration of hibernate sessionfactory-->
<bean id= "Sessionfactory" class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
<property name= "DataSource" ref= "DataSource" ></property>
<property name= "Hibernateproperties" >
<props>
<!--database dialect-->
<prop key= "Hibernate.dialect" >org.hibernate.dialect.Oracle9Dialect</prop>
<!--The SQL statements that are executed in the console print-->
<prop key= "Hibernate.show_sql" >true</prop>
</props>
</property>
<!--load all the entity profiles-->
<property name= "Mappingdirectorylocations" >
<list>
<value>classpath:com/lun/entity</value>
</list>
</property>
</bean>
<!--transaction processor-->
<bean id= "TransactionManager" class= "Org.springframework.orm.hibernate3.HibernateTransactionManager" >
<property name= "Sessionfactory" ref= "Sessionfactory"/>
</bean>
<!--transaction notification configuration-->
<tx:advice id= "Txadvice" transaction-manager= "TransactionManager" >
<tx:attributes>
<tx:method name= "get*" read-only= "true" propagation= "not_supported"/>
<tx:method name= "find*" read-only= "true" propagation= "not_supported"/>
<tx:method name= "select*" read-only= "true" propagation= "not_supported"/>
<tx:method name= "save*" rollback-for= "Exception" propagation= "REQUIRED"/>
<tx:method name= "add*" rollback-for= "Exception" propagation= "REQUIRED"/>
<tx:method name= "update*" rollback-for= "Exception" propagation= "REQUIRED"/>
<tx:method name= "del*" rollback-for= "Exception" propagation= "REQUIRED"/>
<tx:method name= "*" rollback-for= "Exception" propagation= "REQUIRED"/>
</tx:attributes>
</tx:advice>
<!--transaction Slice configuration-->
<aop:config>
<aop:pointcut expression= "Execution (* com.lun.biz.*.* (..))" id= "Transactionpointcut"/>
<aop:advisor advice-ref= "Txadvice" pointcut-ref= "Transactionpointcut"/>
</aop:config>
<!--injected JdbcTemplate-->
<bean id= "JdbcTemplate" class= "Org.springframework.jdbc.core.JdbcTemplate" >
<constructor-arg ref= "DataSource"/>
</bean>
<!--injected Hibernatetemplate-->
<bean id= "Hibernatetemplate" class= "Org.springframework.orm.hibernate3.HibernateTemplate" >
<property name= "Sessionfactory" ref= "Sessionfactory"/>
</bean>
</beans>