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的配置的更多相关文章

  1. 4_2.springboot2.x配置之springmvc自动配置

    1.Spring MVC auto-configuration 查看官方文档: Spring Boot为Spring MVC提供了自动配置,适用于大多数应用程序. 自动配置在Spring的默认值之上添 ...

  2. spring boot @EnableWebMvc禁用springMvc自动配置原理。

    说明: 在spring boot中如果定义了自己的java配置文件,并且在文件上使用了@EnableWebMvc 注解,那么sprig boot 的默认配置就会失效.如默认的静态文件配置路径:&quo ...

  3. 【Spring】简述@Configuration配置类注册BeanDefinition到Spring容器的过程

    概述 本文以SpringBoot应用为基础,尝试分析基于注解@Configuration的配置类是如何向Spring容器注册BeanDefinition的过程 其中主要分析了 Configuratio ...

  4. spring容器和springmvc容器,以及web容器的关系

    说到spring和springmvc,其实有很多人分不清他们有什么区别,认为它俩是一样的,如果你问他项目里用的什么MVC技术,他会说我们用的spring和mybatis,或者spring和hibern ...

  5. Web容器、Servlet容器、Spring容器、SpringMVC容器之间的关系

    以下内容为个人理解,如有误还请留言指出,不胜感激! Web容器 web容器(web服务器)主要有:Apache.IIS.Tomcat.Jetty.JBoss.webLogic等,而Tomcat.Jet ...

  6. web容器、sevlet容器、spring容器、springmvc容器之间的关系

    原文链接:http://www.cnblogs.com/jieerma666/p/10805966.html https://blog.csdn.net/zhanglf02/article/detai ...

  7. 【Spring五】AOP之使用注解配置

    AOP使用注解配置流程: 1.当spring容器启动时候.    < context:component- scan base-package= "cn.itheima03.sprin ...

  8. SpringMVC常用配置(二),最简洁的配置实现文件上传

    Spring.SpringMVC持续介绍中,基础配置前面已经介绍了很多,如果小伙伴们还不熟悉可以参考这几篇文章: 1.Spring基础配置 2.Spring常用配置 3.Spring常用配置(二) 4 ...

  9. spring中的AOP 以及各种通知 配置

    理解了前面动态代理对象的原理之后,其实还是有很多不足之处,因为如果在项目中有20多个类,每个类有100多个方法都需要判断是不是要开事务,那么方法调用那里会相当麻烦. spring中的AOP很好地解决了 ...

随机推荐

  1. netsh学习

    show allowedprogram –显示被允许的程序配置 show config - 显示防火墙的配置 show currentprofile -显示 Windows 防火墙的当前配置文件. s ...

  2. JQuery URL的GET参数值获取方法

    // jQuery url get parameters function [获取URL的GET参数值] // <code> // var GET = $.urlGet(); //获取UR ...

  3. UsageGrideReport++

      迁移时间:2017年5月20日11:42:02CreateTime--2016年9月29日15:46:15Author:Marydon版本Gride Report++6.0使用说明:参考链接:ht ...

  4. 〖Ruby〗Ruby关键字

    模块定义:module 类定义:class 方法定义:def, undef 检查类型:defined? 条件语句:if, then, else, elsif, case, when, unless 循 ...

  5. [ACM] hdu 1671 Phone List (字典树)

    Phone List Problem Description Given a list of phone numbers, determine if it is consistent in the s ...

  6. C#:Use Form as Subform

    static class SubFormExtensions { internal static bool AttachTo(this Form subForm, Panel panel) { if ...

  7. AWK中的OFS的问题

    echo a b c d |awk '{OFS = ":";print $0}' 我的理解是应该把输出显示为如下的方式 a:b:c:d dan但执行的结果不是这样的 a b c d ...

  8. python标准日志模块logging的使用方法

    参考地址 最近写一个爬虫系统,需要用到python的日志记录模块,于是便学习了一下.python的标准库里的日志系统从Python2.3开始支持.只要import logging这个模块即可使用.如果 ...

  9. iOS10 完美降级 iOS9.3.2,保留全部数据

    本篇文章由:http://xinpure.com/downgrade-ios10-perfect-ios9-3-2-retention-of-all-data/ iOS 10 Beta版尝鲜 前段时间 ...

  10. 使用springboot遇到的的异常

    Unregistering JMX-exposed beans on shutdown <dependency> <groupId>org.springframework.bo ...