<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:context= "Http://www.springframework.org/schema/context"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:tx= "Http://www.springframework.org/schema/tx"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5. XSD Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring -context-2.5.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/s Pring-aop-2.5.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/s Pring-tx-2.5.xsd "> <Context:annotation-config/> <Context:component-scanBase-package= "Com.lan" /> <Beanclass= "Org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> < Propertyname= "Locations"> <value>Classpath:jdbc.properties</value> </ Property> </Bean> <BeanID= "DataSource"Destroy-method= "Close"class= "Org.apache.commons.dbcp.BasicDataSource"> < Propertyname= "Driverclassname"value= "${jdbc.driverclassname}" /> < Propertyname= "url"value= "${jdbc.url}" /> < Propertyname= "username"value= "${jdbc.username}" /> < Propertyname= "Password"value= "${jdbc.password}" /> </Bean> <BeanID= "Sessionfactory"class= "Org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> < Propertyname= "DataSource"ref= "DataSource" /> <!--<property name= "annotatedclasses" > <list> <value>com.bjsxt.model. user</value> <value>com.bjsxt.model.Log</value> </list> </prop Erty> - < Propertyname= "Packagestoscan"> <List> <value>Com.lan.registration.model</value> </List> </ Property> < Propertyname= "Hibernateproperties"> <Props> <propKey= "Hibernate.dialect">Org.hibernate.dialect.MySQLDialect</prop> <propKey= "Hibernate.show_sql">True</prop> </Props> </ Property> </Bean> <BeanID= "Hibernatetemplate"class= "Org.springframework.orm.hibernate3.HibernateTemplate"> < Propertyname= "Sessionfactory"ref= "Sessionfactory"></ Property> </Bean> <BeanID= "Txmanager"class= "Org.springframework.orm.hibernate3.HibernateTransactionManager"> < Propertyname= "Sessionfactory"ref= "Sessionfactory" /> </Bean> <Aop:config> <Aop:pointcutID= "Bussinessservice"expression= "Execution (public * com.bjsxt.registration.service.*.* (..))" /> <Aop:advisorPointcut-ref= "Bussinessservice"Advice-ref= "Txadvice" /> </Aop:config> <Tx:adviceID= "Txadvice"Transaction-manager= "Txmanager"> <tx:attributes> <Tx:methodname= "exists"read-only= "true" /> <Tx:methodname= "add*"Propagation= "REQUIRED"/> </tx:attributes> </Tx:advice></Beans>
Spring Beans.xml