<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
<!-- 定义数据源 -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/test">
</property>
<property name="username" value="root"></property>
<property name="password" value="123456"></property>
</bean>
<!-- session工厂 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource">
<ref bean="dataSource" />
</property>
<property name="configLocation" value="classpath:hibernate.cfg.xml"/>
<!-- 自动扫描注解方式配置的hibernate类文件 -->
<property name="packagesToScan">
<list>
<value>com.java1234.entity</value>
</list>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 配置事务通知属性 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<!-- 定义事务传播属性 -->
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="edit*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="add*" propagation="REQUIRED" />
<tx:method name="new*" propagation="REQUIRED" />
<tx:method name="set*" propagation="REQUIRED" />
<tx:method name="remove*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
<tx:method name="change*" propagation="REQUIRED" />
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="find*" propagation="REQUIRED" read-only="true" />
<tx:method name="load*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" propagation="REQUIRED" read-only="true" />
</tx:attributes>
</tx:advice>
<!-- 配置事务切面 -->
<aop:config>
<aop:pointcut id="serviceOperation"
expression="execution(* com.java1234.service..*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation" />
</aop:config>
<!-- 自动加载构建bean -->
<context:component-scan base-package="com.java1234" />
</beans>
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
S2SH整合.rar (49个子文件)
S2SH整合
Hibernate4 jar包
hibernate-jpa-2.1-api-1.0.0.Final.jar 111KB
dom4j-1.6.1.jar 307KB
hibernate-commons-annotations-4.0.4.Final.jar 74KB
mchange-commons-java-0.2.3.4.jar 568KB
hibernate-c3p0-4.3.5.Final.jar 39KB
slf4j-api-1.6.1.jar 25KB
jboss-logging-annotations-1.2.0.Beta1.jar 11KB
jandex-1.1.0.Final.jar 75KB
jboss-logging-3.1.3.GA.jar 56KB
ehcache-core-2.4.3.jar 983KB
javassist-3.18.1-GA.jar 697KB
hibernate-ehcache-4.3.5.Final.jar 132KB
jboss-transaction-api_1.2_spec-1.0.0.Final.jar 27KB
hibernate-core-4.3.5.Final.jar 4.99MB
Struts2 jar包
commons-collections-3.1.jar 546KB
ezmorph-1.0.6.jar 84KB
aopalliance-1.0.jar 4KB
antlr-2.7.7.jar 435KB
freemarker-2.3.19.jar 909KB
asm-3.3.jar 43KB
struts2-spring-plugin-2.3.16.3.jar 21KB
commons-beanutils-1.8.0.jar 226KB
struts2-core-2.3.16.3.jar 782KB
ognl-3.0.6.jar 223KB
commons-logging-1.1.3.jar 61KB
commons-lang-2.4.jar 256KB
asm-commons-3.3.jar 37KB
commons-io-2.2.jar 170KB
xwork-core-2.3.16.3.jar 639KB
commons-lang3-3.1.jar 308KB
commons-fileupload-1.3.1.jar 67KB
web.xml 2KB
struts.xml 316B
Spring4 jar包
spring-beans-4.0.6.RELEASE.jar 655KB
spring-core-4.0.6.RELEASE.jar 954KB
spring-tx-4.0.6.RELEASE.jar 243KB
spring-context-4.0.6.RELEASE.jar 955KB
spring-expression-4.0.6.RELEASE.jar 201KB
spring-jdbc-4.0.6.RELEASE.jar 415KB
spring-webmvc-4.0.6.RELEASE.jar 647KB
spring-context-support-4.0.6.RELEASE.jar 132KB
spring-web-4.0.6.RELEASE.jar 657KB
spring-orm-4.0.6.RELEASE.jar 359KB
aspectjweaver.jar 1.8MB
spring-aspects-4.0.6.RELEASE.jar 51KB
spring-aop-4.0.6.RELEASE.jar 345KB
mysql-connector-java-3.1.12-bin.jar 436KB
hibernate.cfg.xml 625B
applicationContext.xml 4KB
共 49 条
- 1
资源评论
- g4068242832018-02-01谢谢分享,挺不错的资源
xievxin
- 粉丝: 3
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功