spring容器的配置和springmvc的配置
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:mvc="http://www.springframework.org/schema/mvc"
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-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-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 "> <!-- . 加载数据库配置的属性文件 -->
<context:property-placeholder location="classpath:jdbc.properties"/> <!-- . 包扫描dao,service -->
<context:component-scan base-package="cn.itcast.jk.dao,cn.itcast.jk.service"/> <!-- . 数据源dataSource C3P0 -->
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="${jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/> <property name="maxPoolSize" value="${c3p0.pool.maxPoolSize}"/>
<property name="minPoolSize" value="${c3p0.pool.minPoolSize}"/>
<property name="initialPoolSize" value="${c3p0.pool.initialPoolSize}"/>
<property name="acquireIncrement" value="${c3p0.pool.acquireIncrement}"/>
</bean> <!-- . SessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<!-- 整合mybatis,包扫描 mapper文件 -->
<property name="configLocation" value="classpath:sqlMapConfig.xml"/>
<property name="mapperLocations" value="classpath:cn/itcast/jk/mapper/*.xml"/>
</bean> <!-- 整合sping jdbcTemplate -->
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
<bean id="sqlDao" class="cn.itcast.common.springdao.SqlDao">
<property name="jdbcTemplate" ref="jdbcTemplate"/>
</bean> <!-- . 事务 -->
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean> <tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="save*" propagation="REQUIRED"/> <tx:method name="find*" read-only="true"/>
<tx:method name="get*" read-only="true"/>
<tx:method name="view*" read-only="true"/>
</tx:attributes>
</tx:advice> <aop:config>
<aop:pointcut expression="execution(* cn.itcast.jk.service.*.*(..))" id="txPointcut"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
</aop:config> </beans>
springmvc的配置
<?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:mvc="http://www.springframework.org/schema/mvc"
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-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-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 "> <mvc:annotation-driven></mvc:annotation-driven> <!-- . 包扫描 controller -->
<context:component-scan base-package="cn.itcast.jk.controller"/> <!-- . 内部资源视图解析器 -->
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages"/>
<property name="suffix" value=""/>
</bean> </beans>
oracle和mysql的配置信息
#jdbc.driverClassName=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://localhost:3306/jkdb?characterEncoding=utf-8
#jdbc.username=root
#jdbc.password= jdbc.driverClassName=oracle.jdbc.driver.OracleDriver
jdbc.url=jdbc:oracle:thin:@127.0.0.1::ORCL
jdbc.username=jkdb
jdbc.password= c3p0.pool.maxPoolSize=
c3p0.pool.minPoolSize=
c3p0.pool.initialPoolSize=
c3p0.pool.acquireIncrement=
spring容器的配置和springmvc的配置的更多相关文章
- 4_2.springboot2.x配置之springmvc自动配置
1.Spring MVC auto-configuration 查看官方文档: Spring Boot为Spring MVC提供了自动配置,适用于大多数应用程序. 自动配置在Spring的默认值之上添 ...
- spring boot @EnableWebMvc禁用springMvc自动配置原理。
说明: 在spring boot中如果定义了自己的java配置文件,并且在文件上使用了@EnableWebMvc 注解,那么sprig boot 的默认配置就会失效.如默认的静态文件配置路径:&quo ...
- 【Spring】简述@Configuration配置类注册BeanDefinition到Spring容器的过程
概述 本文以SpringBoot应用为基础,尝试分析基于注解@Configuration的配置类是如何向Spring容器注册BeanDefinition的过程 其中主要分析了 Configuratio ...
- spring容器和springmvc容器,以及web容器的关系
说到spring和springmvc,其实有很多人分不清他们有什么区别,认为它俩是一样的,如果你问他项目里用的什么MVC技术,他会说我们用的spring和mybatis,或者spring和hibern ...
- Web容器、Servlet容器、Spring容器、SpringMVC容器之间的关系
以下内容为个人理解,如有误还请留言指出,不胜感激! Web容器 web容器(web服务器)主要有:Apache.IIS.Tomcat.Jetty.JBoss.webLogic等,而Tomcat.Jet ...
- web容器、sevlet容器、spring容器、springmvc容器之间的关系
原文链接:http://www.cnblogs.com/jieerma666/p/10805966.html https://blog.csdn.net/zhanglf02/article/detai ...
- 【Spring五】AOP之使用注解配置
AOP使用注解配置流程: 1.当spring容器启动时候. < context:component- scan base-package= "cn.itheima03.sprin ...
- SpringMVC常用配置(二),最简洁的配置实现文件上传
Spring.SpringMVC持续介绍中,基础配置前面已经介绍了很多,如果小伙伴们还不熟悉可以参考这几篇文章: 1.Spring基础配置 2.Spring常用配置 3.Spring常用配置(二) 4 ...
- spring中的AOP 以及各种通知 配置
理解了前面动态代理对象的原理之后,其实还是有很多不足之处,因为如果在项目中有20多个类,每个类有100多个方法都需要判断是不是要开事务,那么方法调用那里会相当麻烦. spring中的AOP很好地解决了 ...
随机推荐
- MVC日期和其它字符串格式化
-- (月份位置不是03) string.Format("{0:D}",System.DateTime.Now) 结果为:2009年3月20日 : :: -- : -- :: st ...
- Linux下TCP最大连接数受限问题
一. 文件数限制修改1.用户级别查看Linux系统用户最大打开文件限制:# ulimit -n1024 (1) vi /etc/security/limits.confmysql soft nofil ...
- C#:设置焦点在最小的TabIndex控件上
private void FocusFirstTabIndex(Control container) { // init search result varialble Control searchR ...
- 微信小程序-基于canvas画画涂鸦
代码地址如下:http://www.demodashi.com/demo/14461.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...
- 微信小程序-简易计算器
代码地址如下:http://www.demodashi.com/demo/14210.html 一.前期准备工作 软件环境:微信开发者工具 官方下载地址:https://mp.weixin.qq.co ...
- JNI入门
JNI是Java Native Interface的缩写,Native指C/C++. JNI内容涉及两个方面: Java调用C,这种情况是最主要的 C调用Java,这种情况不常见 第一步:编写Java ...
- ASP.NET 安全系列 Membership三步曲之入门篇 - Jesse Liu
Membership 三步曲 ASP.NET 安全系列 Membership三步曲之入门篇 ASP.NET 安全系列 Membership三步曲之进阶篇 ASP.NET 安全系列 Membership ...
- Excel提示“此工作簿包含一个或多个无法更新的链接”怎么办
有时打开Excel文件时会弹出一个“此工作簿包含一个或多个无法更新的链接”的提示.对于初次接触这个提示的用户,可能会感到迷惑,不知道应该如何处理,这里以Excel2007为例,介绍一下这个提示出现的原 ...
- OAF_Oracle Application Framework基本知识点(概念)
2014-02-06 Created By BaoXinjian
- git配置gitignore
一.背景 ...