<?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: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.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<!-- 配置DATASOURCE -->
<bean id="dataSource"
class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="user" value="sa"></property>
<property name="password" value=""></property>
<property name="driverClass"
value="com.microsoft.sqlserver.jdbc.SQLServerDriver">
</property>
<property name="jdbcUrl"
value="jdbc:sqlserver://192.168.0.100:1433;databaseName=users">
</property>
</bean>
<!-- sessionfactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="mappingResources">
<list>
<value>entity/Userinfo.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.SQLServerDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<!-- 配置事务管理器 -->
<bean id="tm"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 设置事务注入的利度 -->
<tx:advice id="myAdvice" transaction-manager="tm">
<tx:attributes>
<tx:method name="get*" propagation="SUPPORTS"
read-only="true" />
<tx:method name="update*" propagation="REQUIRED" />
<tx:method name="save*" propagation="REQUIRED" />
<tx:method name="delete*" propagation="REQUIRED" />
</tx:attributes>
</tx:advice>
<!-- 注入 -->
<aop:config>
<aop:pointcut id="bizMethods"
expression="execution(* biz.*.*(..))" />
<aop:advisor advice-ref="myAdvice" pointcut-ref="bizMethods" />
</aop:config>
<!-- 注入DAO -->
<bean id="userDao" class="dao.impl.UserinfoDaoImpl">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 注入biz -->
<bean id="userBiz" class="biz.impl.UserinfoBizImpl">
<property name="userDao" ref="userDao"></property>
</bean>
<!-- action配置 -->
<bean name="/user" class="web.action.UserinfoDispatchAction">
<property name="userBiz" ref="userBiz"></property>
</bean>
</beans>
分享到:
相关推荐
Spring2.5提供了更灵活的配置方法, 本文档详细介绍了Spring2.x通过XML文件和Annotation如何配置Spring bean,事务管理配置,AOP的详细配置,以及其他Spring所提供支持的配置。
详细的spring security2.x配置
本书是在《精通Spring 3.x――企业应用开发详解》的基础上,历时一年的重大调整改版而成的,延续了上一版本“追求深度,注重原理,不停留在技术表面”的写作风格,力求使读者在熟练使用Spring的各项功能的同时透彻...
Spring 2.x aop配置详解 Spring 2.x aop配置详解 Spring 2.x aop配置详解 Spring 2.x aop配置详解 Spring 2.x aop配置详解 Spring 2.x aop配置详解
spring cloud 2.x 体系中,我们经常想读取我们自己的配置文件从远程,(例如配置中心),并且配置中心中的值变化后,希望spring cloud 也能感知到,那怎么与spring cloud 这套体系打通呢?请看上传源码。
这个最早源于spring2.x时代的spring-modules项目中的cache子项目 我自己也曾经仿造者,并且基于aspectj山寨过过aop annotation cache 在大部分简单的cache场景都是非常好用的 少部分需要精确evict key的场景还不适合...
spring-boot 2.X中文配置.................................................................................................................................................
NULL 博文链接:https://conkeyn.iteye.com/blog/2173075
本课程内容包括Spring简介、Spring Boot简介、安装JDK、安装Maven、第...配置数据源、Spring Data JPA代码、Spring Data JPA增删改查实例、安装Redis和可视化客户端、Redis缓存配置、Redis缓存实例、Redis消息、测试...
此处提供三个文档,有用配置文件直接配的,有借助eclipse工具生成的,对最近的Struts+Spring+Hibernate进行带图文的详细整合接受,此文档由本人进行整理,希望对大家有所帮助。
博文链接:https://log-cd.iteye.com/blog/213445
Struts1.x Spring2.x Hibernate3.x DWR2.x整合工具文档v1.00 方便学生使用的工具文档 里面有比较全的经典配置文件示例 更多请见我博客 http://blog.csdn.net/shadowkiss
本书是在《精通Spring 3.x——企业应用开发详解》的基础上,历时一年的重大调整改版而成的,延续了上一版本“追求深度,注重原理,不停留在技术表面”的写作风格,力求使读者在熟练使用Spring的各项功能的同时透彻...
本书是在《精通Spring 3.x——企业应用开发详解》的基础上,历时一年的重大调整改版而成的,延续了上一版本“追求深度,注重原理,不停留在技术表面”的写作风格,力求使读者在熟练使用Spring的各项功能的同时透彻...
Spring4.x基础配置(二):Java配置 Github项目地址: 码云项目地址: 文章地址: Spring4.x基础配置(三):Spring AOP Github项目地址:spring4.x-aop 码云项目地址:spring4.x-aop 文章地址:Spring4.x基础配置(三):...
本书是在《精通Spring 3.x――企业应用开发详解》的基础上,历时一年的重大调整改版而成的,延续了上一版本“追求深度,注重原理,不停留在技术表面”的写作风格,力求使读者在熟练使用Spring的各项功能的同时透彻...
======================================================================== <br>第1篇 概述 第1章 Spring概述 第2章 快速入门 第2篇 Spring核心技术 第3章 IoC容器概述 第4章 在IoC容器中...
======================================================================== <br>第1篇 概述 第1章 Spring概述 第2章 快速入门 第2篇 Spring核心技术 第3章 IoC容器概述 第4章 在IoC容器中...
本书是在《精通Spring 3.x——企业应用开发详解》的基础上,历时一年的重大调整改版而成的,延续了上一版本“追求深度,注重原理,不停留在技术表面”的写作风格,力求使读者在熟练使用Spring的各项功能的同时透彻...