首页 > 代码库 > spring基本配置
spring基本配置
基本配置
<?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: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/spring-aop-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="configLocation"> <value> classpath:hibernate.cfg.xml </value> </property> </bean> <bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <aop:config> <aop:pointcut expression="execution(public * com.hnct.rpms.service*.*.*(..))" id="txAop" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="txAop" /> </aop:config> <tx:advice id="txAdvice" transaction-manager="txManager"> <tx:attributes> <!-- 当调用方法没有transaction时,则创建,有就不需要了 --> <tx:method name="*" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <bean id="IUserDao" class="com.hnct.rpms.dao.impl.UserDaoImpl"> <property name="sessionFactory" ref="sessionFactory"></property> </bean> <bean id="IUserService" class="com.hnct.rpms.service.impl.UserServiceImpl"> <property name="userDao" ref="IUserDao"></property> </bean> <bean id="userAction" class="com.hnct.rpms.action.UserAction" scope="prototype"> <property name="userService" ref="IUserService"></property> <property name="roleService" ref="IRoleService"></property> </bean>
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。