applicationContext.xml的基本配置文件
<?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的基本配置文件的更多相关文章
- applicationContext.xml最基本配置文件
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.sp ...
- 在web.xml注册applicationContext.xml配置文件
概要: Spring配置文件是集成了Spring框架的项目的核心,引擎的开始是:容器先是加载web.xml,接着是applicationContext.xml在web.xml里的注册.以下我们将介绍a ...
- Spring配置文件详解 - applicationContext.xml文件路径
spring的配置文件applicationContext.xml的默认地址在WEB-INF下,只要在web.xml中加入代码 org.springframework.web.context.Cont ...
- @Value取不到值引出的spring的2种配置文件applicationContext.xml和xxx-servlet.xml
项目中经常会用到配置文件,定义成properties的形式比较常见,为了方便使用一般在spring配置文件中做如下配置: <context:property-placeholder ignore ...
- Spring配置文件详解 – applicationContext.xml文件路径
Spring配置文件详解 – applicationContext.xml文件路径 Java编程 spring的配置文件applicationContext.xml的默 ...
- Spring 配置文件applicationContext.xml
Spring配置文件是用于指导Spring工厂进行Bean生产.依赖关系注入(装配)及Bean实例分发的"图纸". Spring配置文件是一个或多个标准的XML文档,applica ...
- [JavaEE] applicationContext.xml配置文件使用合集
配置实例 – 1 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http ...
- 【applicationContext.xml】配置文件找不到
配置文件找不到时可以手动配置一下此处 信息: Initializing Spring root WebApplicationContext 八月 12, 2015 5:36:45 下午 org.apa ...
- applicationContext.xml 配置文件的存放位置
eb.xml中classpath:和classpath*: 有什么区别? classpath:只会到你的class路径中查找找文件; classpath*:不仅包含class路径,还包括jar文件中 ...
随机推荐
- 原: 安装VMtools过程流水帐
以下基于 vm12.0.0 1. 一定要打开虚拟机的 cd设置 2. 然后 cd '/medal/VMware tools ' (注意一定要加 '', 因为VMware tools 有空格) ...
- [LeetCode] Kth Smallest Element in a BST 二叉搜索树中的第K小的元素
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Not ...
- Ubuntu apache2.4 设置虚拟主机
每次重装系统如何配置都上网找,搞半天,都是不对的,还不如自己记下来,以作参考呢.我的项目目录是 /home/feiffy/demo/test,映射的域名是 test.com,这样在浏览器输入 test ...
- Equal Sides Of An Array
参考:http://stackoverflow.com/questions/34584416/nested-loops-with-arrays You are going to be given an ...
- DOM基础知识
DOM BOMDOM 文档对象模型 document.BOM 浏览器界面上所有内容 broder object.没有括号属性.()方法 DOM写法 document.作用 做特效 找到 摘出元素 增删 ...
- java学习笔记之正则表达式
一般来说,正则表达式就是以某种方式来描述字符串,因此你可与说:"如果一个字符串符合有这些东西,那么它就是我正在找的东西. 1.要找一个数字,如果它可能有一个负号在最前面(可能没有,没有也是匹 ...
- wxpython绘制折线图
environment:win10 + eclipse + pydev + python2.7.11 + wxpython3.0.2 code sample: #!/usr/bin/env pytho ...
- SVN 错误 Access to SVN Repository Forbidden的原因及解决方法
原创文章,转载请注明出处:http://www.cnblogs.com/baipengzhan/p/SVN_Access_to_SVN_Repository_Forbidden.html 当我们新 ...
- 如果mac电脑的usb转接器连接wlan时不显示,也就是不识别usb此时的网络连接没有,解决办法就是如下
1.接上电源 关机 先按下shift +ctrl + opt + 开机键 ,等待10秒,这10秒是没有反应的,屏幕不会亮,系统不会跑起来, 10秒之后松开所有键,再按下opt + cmd ...
- AJAX应用小案例
此案例在XAMPP本地服务器上运行,需要应用jquery3.1.1的版本,应用JSON传递数据 代码如下: html代码: <!DOCTYPE html><html lang=&qu ...