SSH整合applicationContext.xml配置文件(my project)
来源:互联网 发布:魔音通话软件 编辑:程序博客网 时间:2024/05/21 07:48
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd ">
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" p:driverClass="com.mysql.jdbc.Driver"
p:jdbcUrl="jdbc:mysql://guardskill.cn:3306/market" p:user="user"
p:password="S1042h28" p:maxPoolSize="40" p:minPoolSize="2"
p:initialPoolSize="2" p:maxIdleTime="30" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource">
<!-- define the dateSource's construction's parameter -->
<!-- define the sessionFactory's property -->
<property name="annotatedClasses">
<list>
<value>cn.guardskill.orm.User</value>
<value>cn.guardskill.orm.Good</value>
<value>cn.guardskill.orm.Indent</value>
</list>
</property>
<!-- <property name="mappingDirectoryLocations"> <list> <value>>classpath:cn/guardskill/orm</value>
</list> </property> -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
</bean>
<bean id="userService" class="cn.guardskill.service.UserServiceIm"
p:userDao-ref="userDao" />
<bean id="userDao" class="cn.guardskill.dao.UserHibernate"
p:sessionFactory-ref="sessionFactory" />
<!-- map struts's action to really entity -->
<bean id="userAction" class="cn.guardskill.action.UserAction"
scope="prototype" p:userService-ref="userService"></bean>
<!-- 配置事务管理Bean -->
<bean id="txManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<!-- 配置事务增强 -->
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<!-- spring支持对不同的方法使用不同的事物机制(propagation),方法名支持通配符 -->
<tx:method name="get*" propagation="REQUIRED" read-only="true" />
<tx:method name="*" isolation="DEFAULT" propagation="REQUIRED"
timeout="5" />
</tx:attributes>
</tx:advice>
<!-- 配置切面 -->
<aop:config>
<aop:pointcut id="myPoincut"
expression="execution(public * cn.guardskill.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="myPoincut" />
</aop:config>
</beans>
<?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:beans="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd ">
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close" p:driverClass="com.mysql.jdbc.Driver"
p:jdbcUrl="jdbc:mysql://guardskill.cn:3306/market" p:user="user"
p:password="S1042h28" p:maxPoolSize="40" p:minPoolSize="2"
p:initialPoolSize="2" p:maxIdleTime="30" />
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
p:dataSource-ref="dataSource">
<!-- define the dateSource's construction's parameter -->
<!-- define the sessionFactory's property -->
<property name="annotatedClasses">
<list>
<value>cn.guardskill.orm.User</value>
<value>cn.guardskill.orm.Good</value>
<value>cn.guardskill.orm.Indent</value>
</list>
</property>
<!-- <property name="mappingDirectoryLocations"> <list> <value>>classpath:cn/guardskill/orm</value>
</list> </property> -->
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.connection.autocommit">true</prop>
</props>
</property>
</bean>
<bean id="userService" class="cn.guardskill.service.UserServiceIm"
p:userDao-ref="userDao" />
<bean id="userDao" class="cn.guardskill.dao.UserHibernate"
p:sessionFactory-ref="sessionFactory" />
<!-- map struts's action to really entity -->
<bean id="userAction" class="cn.guardskill.action.UserAction"
scope="prototype" p:userService-ref="userService"></bean>
<!-- map struts's action to really entity -->
<!-- 配置事务管理Bean -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
<property name="dataSource" ref="dataSource"></property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- 配置事务增强 -->
</beans>
- SSH整合applicationContext.xml配置文件(my project)
- SSH配置文件之applicationContext.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- Hibernate与Spring整合,配置文件applicationContext.xml
- spring整合mybatis的applicationContext.xml配置文件
- SSM整合之applicationContext.XML配置文件详解
- spring、mybatis整合核心配置文件applicationContext.xml
- SSM整合之applicationContext.XML配置文件详解
- spring、hibernate整合核心配置文件applicationContext.xml
- ssh整合 web.xml 配置文件
- SSH整合配置applicationContext.xml/hibernate.cfg.xml/struts.xml
- my applicationContext.xml
- SSH2整合项目开发中spring配置文件applicationContext.xml分析
- Spring整合了CXF的一个applicationContext.xml的配置文件
- SSH2整合项目开发中spring配置文件applicationContext.xml分析
- 搭建SSH框架的时候的applicationContext.xml配置文件
- SSH读取applicationContext.xml配置文件测试hibernate方法
- ssh整合!Struts.xml、hibernate与spring整合的applicationContext.xml、web.xml文件的配置!
- 值传递、地址传递与引用传递的使用
- 实训4/6 Python 字典、元组、set集合
- 常见的异常类型
- 两个指针相减的结果
- 常见的异常类型
- SSH整合applicationContext.xml配置文件(my project)
- Tinker使用过程及注意点(2)-360加固及多渠道分包
- Hadoop之HDFS原理
- 01背包(讲解)
- C++实验6-矩阵求和
- Java并发编程:volatile关键字解析
- select poll epoll讲解
- 520. Detect Capital
- Java基础知识【下】