<?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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">

<!-- 配置连接池: -->
<!-- 引入外部属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/>
<!-- 配置C3P0连接池: -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driver}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.user}"/>
<property name="password" value="${jdbc.password}"/>
</bean>

<!-- Hibernate的相关信息 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<!-- 注入连接池 -->
<property name="dataSource" ref="dataSource"/>
<!-- 配置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>
<prop key="hibernate.connection.autocommit">false</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<!-- 配置Hibernate的映射文件 -->
<property name="mappingResources">
<list>
<value>cn/itcast/shop/user/vo/User.hbm.xml</value>
<value>cn/itcast/shop/category/vo/Category.hbm.xml</value>
<value>cn/itcast/shop/product/vo/Product.hbm.xml</value>
<value>cn/itcast/shop/categorysecond/vo/CategorySecond.hbm.xml</value>
<value>cn/itcast/shop/order/vo/Order.hbm.xml</value>
<value>cn/itcast/shop/order/vo/OrderItem.hbm.xml</value>
<value>cn/itcast/shop/adminuser/vo/AdminUser.hbm.xml</value>
</list>
</property>
</bean>

<!-- 事务管理: -->
<!-- hibernate事务管理器 -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<!--mybatis中SQLSessionFactory-->

  <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactory">

  <property name="configLocation" value="mybatis/SqlMapConfig.xml"/>

  <property name="dataSource" ref="dataSource" />

  </bean>

<!-- 开启注解事务 -->
<tx:annotation-driven transaction-manager="transactionManager"/>

<!--mapper配置-->
  <bean id="userMapper" class="org.mybatis.spring.mapper.MapperFactoryBean">

  <property name="sqlsessionFactory" ref="sqlsessionFactory"/>

  </bean>

<!--mapper批量扫描-->

<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">

<!--指定包名-->

<peoperty name="basePackage" value="ssm.mapper"/>

<peoperty name="sqlSessiomFactoryBeanName" value="sqlSessionFactory"/>
</beans>

applicationContext.xml的基本配置文件的更多相关文章

  1. applicationContext.xml最基本配置文件

    <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...

  2. 在web.xml注册applicationContext.xml配置文件

    概要: Spring配置文件是集成了Spring框架的项目的核心,引擎的开始是:容器先是加载web.xml,接着是applicationContext.xml在web.xml里的注册.以下我们将介绍a ...

  3. Spring配置文件详解 - applicationContext.xml文件路径

    spring的配置文件applicationContext.xml的默认地址在WEB-INF下,只要在web.xml中加入代码 org.springframework.web.context.Cont ...

  4. @Value取不到值引出的spring的2种配置文件applicationContext.xml和xxx-servlet.xml

    项目中经常会用到配置文件,定义成properties的形式比较常见,为了方便使用一般在spring配置文件中做如下配置: <context:property-placeholder ignore ...

  5. Spring配置文件详解 – applicationContext.xml文件路径

    Spring配置文件详解 – applicationContext.xml文件路径 Java编程                 spring的配置文件applicationContext.xml的默 ...

  6. Spring 配置文件applicationContext.xml

    Spring配置文件是用于指导Spring工厂进行Bean生产.依赖关系注入(装配)及Bean实例分发的"图纸". Spring配置文件是一个或多个标准的XML文档,applica ...

  7. [JavaEE] applicationContext.xml配置文件使用合集

    配置实例 – 1 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http ...

  8. 【applicationContext.xml】配置文件找不到

    配置文件找不到时可以手动配置一下此处 信息: Initializing Spring root WebApplicationContext 八月 12, 2015 5:36:45 下午 org.apa ...

  9. applicationContext.xml 配置文件的存放位置

    eb.xml中classpath:和classpath*:  有什么区别? classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中 ...

随机推荐

  1. h5+mui

    参考链接http://blog.csdn.net/tbwood/article/details/42081861 待补充

  2. linux查看主板型号及内存硬件信息

      公司服务器内存不够用了. 想看看买啥型号的. 购买内存条注意点: ddr3 or4 频率 块钱. 内存槽及内存条: dmidecode |grep -A16 "Memory Device ...

  3. [LeetCode] Course Schedule 课程清单

    There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prer ...

  4. OLTP(on-line transaction processing)与OLAP(On-Line Analytical Processing)

    OLTP与OLAP的介绍 数据处理大致可以分成两大类:联机事务处理OLTP(on-line transaction processing).联机分析处理OLAP(On-Line Analytical ...

  5. JavaScript的基本语法

    1.脚本的基本结构如下: <script language="JavaScript"> <!--JavaScript语句:--> </script&g ...

  6. web前端面试试题总结---html篇

    HTML Doctype作用?标准模式与兼容模式各有什么区别? (1).<!DOCTYPE>声明位于位于HTML文档中的第一行,处于 <html> 标签之前.告知浏览器的解析器 ...

  7. hibernate处理null 时提示:Property path [...] does notreference a collection

    Hibernate判断某属性不为null 且不可为空时出现Property path [...] does notreference a collection 的问题 处理空的方法: isNotEmp ...

  8. 扩展欧几里得 exGCD

    Elementary Number Theory - Extended Euclid Algorithm Time Limit : 1 sec, Memory Limit : 65536 KB Jap ...

  9. .net 项目生成时自动更新版本号

    https://www.codeproject.com/articles/31236/how-to-update-assembly-version-number-automaticall Exampl ...

  10. Eclipse安装scala

    Scala官方提供了三种插件,分别支持Eclipse.NetBeans和Intellij IDEA开发环境.要在Eclipse IDE下安装Scala插件:选择Eclipse的菜单项Help--> ...