<?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. Hbase学习连接-数据导入

    http://www.csdn.net/article/2014-01-07/2818046

  2. ngx_http_upstream_module模块.md

    ngx_http_upstream_module ngx_http_upstream_module模块用于定义可由proxy_pass,fastcgi_pass,uwsgi_pass,scgi_pas ...

  3. mysql benchmark基准测试

    git项目地址: https://github.com/akopytov/sysbench 利用sysbench很容易对mysql做性能基准测试(当然这个工具很强大,除了测试主流数据库性能,还能测试其 ...

  4. [LeetCode] Candy 分糖果问题

    There are N children standing in a line. Each child is assigned a rating value. You are giving candi ...

  5. vue 2.0 开发实践总结之疑难篇

    续上一篇文章:vue2.0 开发实践总结之入门篇 ,如果没有看过的可以移步看一下. 本篇文章目录如下: 1.  vue 组件的说明和使用 2.  vuex在实际开发中的使用 3.  开发实践总结 1. ...

  6. [干货]Chloe官网及基于NFine的后台源码毫无保留开放

    扯淡 经过不少日夜的赶工,Chloe 的官网于上周正式上线.上篇博客中LZ说过要将官网以及后台源码都会开放出来,为了尽快兑现我说过的话,趁周末,我稍微整理了一下项目的源码,就今儿毫无保留的开放给大家, ...

  7. TextView字体阴影效果

    android:shadowDx="1" android:shadowDy="1" android:shadowColor="#8c8c8c" ...

  8. 修改 jquery.validate.js 支持非form标签

    尝试使用markdown来写一篇blog,啦啦啦 源代码传送门:github 在特殊情况下我们使用jquery.validate.js对用户输入的内容做验证的时候,表单并不是一定包含在form之中,有 ...

  9. WEB – Architecture

  10. Dev控件GridView单元格绑定控件

    Dev控件GridView单元格绑定控件 //文本按钮 RepositoryItemButtonEdit btnFields = new RepositoryItemButtonEdit();//创建 ...