<?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:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee" xsi:schemaLocation=" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 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/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd"> <context:annotation-config/> <context:component-scan base-package="cn.mrxia"></context:component-scan> <!--1 设置连接参数信息 --> <bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="username" value="root"></property> <property name="password" value="root"></property> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql://localhost:3306/hibernate?useUnicode=true&characterEncoding=utf8"></property> </bean> <!--2 把dataSource交给sessionFactory 在hibernate里面,想用注解需要创建AnnotationConfiguration,而在spring中用AnnotationSessionFactoryBean --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <!-- 把连接参数信息注入给dataSource --> <property name="dataSource" ref="myDataSource"></property> <!-- hibernate框架参数 --> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> </props> </property> <!--packagesToScan:自动扫描实体类 (在hibernate中通过<mapping class="cn.mrxia.entity.User"/>指定注解的类),指定则用annotatedClasses属性 <property name="annotatedClasses"> <list><value>cn.mrxia.entity</value></list></property>--> <property name="packagesToScan"> <list> <value>cn.mrxia.entity</value> </list> </property> <!-- 指定hbm.xml映射描述 <property name="mappingResources"> <list> <value>xia/domain/Cost.hbm.xml</value> </list> </property> --> </bean> <!--3 把sessionFactory交给hibernateTemplate --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <!-- 如果要在service层使用事务,需声明事务管理 --> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <aop:config> <aop:pointcut id="bussinessService" expression="execution(public * cn.mrxia.service.*.*(..))" /> <aop:advisor pointcut-ref="bussinessService" advice-ref="txAdvice" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <tx:method name="exists" read-only="true" /> <tx:method name="add*" propagation="REQUIRED"/> </tx:attributes> </tx:advice> <!-- <bean id="demoAction" scope="prototype" class="xia.action.DemoAction"> <property name="costDao" ref="costDAO"></property> </bean> <bean id="costDAO" class="xia.dao.impl.HibernateCostDaoImpl"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> --> </beans>
相关推荐
该资源中包含SSH框架整合中spring框架所需要的配置文件:applcationContext.xml和log4j.proerties
给大家分享一个前几年闲着蛋疼写(应该叫整合吧)的一个WEB应用框架,整合了Spring,使用的是SpringMVC,而不是Struts,Java开源框架Shiro,持久层框架Hibernate。实现的主要功能有,用户的管理,角色管理,可配置的...
Spring Security与SSH整合,Spring Security通过数据库给用户认证授权,且jar完整,除了简单配置数据库,即可运行!
SSH框架整合,全jpa注解真正的零配置。 struts2.3.8 spring3.2 hibernate4.1.9. 带有分页,全局异常,权限拦截器,session过滤等功能。 内有jar包。导入开发工具后部署既可跑起来。已做了简单的数据库操作功能。供...
SSH三大框架整合 struts2(使用xml配置)+hibernate(使用xml配置)+spring(使用xml配置),实现分页查询,其他增删该查的接口已经写好。
JavaWeb中的Jar包整合,并配置了Struts的配置文件,hibernate的配置文件,Spring的配置文件。(配置文件是空的,但是有配置文件的头)
ssh 整合 struts hibernate spring 三大框架 大部分配置都已配好 下载即可用 (缺包自己搞)
SSH(struts2,Hibernate,Spring)整合及测试亲测可用,百分之白亲测可用。
SSH整合配置文件 struts2.2 +hibernate3.1+ spring2.1 整合配置文件
ssh整合所需的jar包,spring-4.2.4版本,c3p0连接池,mysql数据库,hibernate-5.0.7版本,struts-2.3.24版本, spring-mvc.xml文件,web.xml文件,spring-common.xml文件,Adc.hbm.xml文件
SSH框架整合,全jpa注解真正的零配置。 struts2.3.8 spring3.2 hibernate4.1.9. 带有分页,全局异常,权限拦截器,session过滤等功能。 内有jar包。导入开发工具后部署既可跑起来。已做了简单的数据库操作功能。供...
hibernate + struts2+spring三大框架的整合 SSH整合方式二将hibernate的配置交给Spring管理
这是一个SSH的整合和配置,里面有具体的视频,还有说明
struts2+hibernate4+spring3的整合 步骤:a. 创建数据库表 userinfo b. 创建web工程,导入支持 c. 数据库表反向工程 d.向上推 jsp --> action --> service --> dao --> db e.配置spring 的...
先配置事务管理器,注意现在使用的是Hibernate框架,所以需要使用Hibernate框架的事务管理器
ssh整合demo 整合, structs 附带了多个测试页面可以跳转,写了一个简单action,structs.xml 使用了模糊匹配, spring 注释方式 注入依赖,xml方式实现aop,hibernate 配置好数据库,可自动生成表,标准的model ,dao...