Spring完整配置文件带注释(自动扫包)
来源:互联网 发布:户型设计软件 编辑:程序博客网 时间:2024/04/28 21:02
<?xml version="1.0" encoding="UTF-8"?><beans default-autowire="byName" default-lazy-init="true" 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:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd "> <!-- 开启注解配置 --> <context:annotation-config /> <!-- 对指定的包进行组件扫描 --> <context:component-scan base-package="com.lun" /> <!--链接数据库 --> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property> <property name="url" value="jdbc:oracle:thin:@127.0.0.1:1521:orcl"></property> <property name="username" value="lun"></property> <property name="password" value="123"></property> </bean> <!-- 配置hibernate的sessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"></property> <property name="hibernateProperties"> <props> <!-- 数据库方言 --> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop> <!-- 在控制台打印执行的sql语句 --> <prop key="hibernate.show_sql">true</prop> </props> </property> <!-- 加载所有的实体配置文件 --> <property name="mappingDirectoryLocations"> <list> <value>classpath:com/lun/entity</value> </list> </property> </bean> <!-- 事务处理器 --> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <!-- 事务通知配置 --> <tx:advice id="txAdvice" transaction-manager="transactionManager"> <tx:attributes> <tx:method name="get*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="find*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="select*" read-only="true" propagation="NOT_SUPPORTED" /> <tx:method name="save*" rollback-for="Exception" propagation="REQUIRED" /> <tx:method name="add*" rollback-for="Exception" propagation="REQUIRED" /> <tx:method name="update*" rollback-for="Exception" propagation="REQUIRED" /> <tx:method name="del*" rollback-for="Exception" propagation="REQUIRED" /> <tx:method name="*" rollback-for="Exception" propagation="REQUIRED" /> </tx:attributes> </tx:advice> <!-- 事务切面配置 --> <aop:config> <aop:pointcut expression="execution(* com.lun.biz.*.*(..))" id="transactionPointcut" /> <aop:advisor advice-ref="txAdvice" pointcut-ref="transactionPointcut" /> </aop:config> <!-- 注入jdbcTemplate --> <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <constructor-arg ref="dataSource"/> </bean> <!-- 注入hibernateTemplate --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate"> <property name="sessionFactory" ref="sessionFactory" /> </bean></beans>
0 0
- Spring完整配置文件带注释(自动扫包)
- Spring完整配置文件带注释(自动扫包)
- spring 自动扫包代码放置的位置问题
- Spring扫包问题
- Struts2完整配置文件带注释(开发项目期间最实用)
- web.xml完整配置文件带注释(已配置错误页)
- Struts2完整配置文件带注释(开发项目期间最实用)
- web.xml完整配置文件带注释(已配置错误页)
- spring完整配置文件
- spring配置文件注释
- Vim配置文件,带详细注释
- .vimrc 配置文件( 带注释)
- vim配置文件(带中文注释)
- Spring MVC 注解 initMethod 扫包
- spring 全注解 扫包问题
- spring自动扫面和管理bean
- Spring自动扫面和依赖注入
- mybatis自动扫包,扫描不到jar包的解决方法
- Redis的常用命令
- web.xml完整配置文件带注释(已配置错误页)
- iOS学习之UINavigationController详解与使用(一)添加UIBarButtonItem
- weakness
- 如何判断Javascript对象是否存在
- Spring完整配置文件带注释(自动扫包)
- linux--bus驱动-初级--只实现bus总线程序模块设计
- 《WinCE下应用程序开发》系列之开发步骤
- 清除或修改WinCE拨号参数附加命令
- 涉及业务,请保持独立
- playframework开发一些tips(class)
- android的混淆器
- UITabBarController的外观修改总结
- centos6.x 和centos5.x nfs 服务配置