zoukankan      html  css  js  c++  java
  • ssm整合的spring.xml文件配置(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:tx="http://www.springframework.org/schema/tx"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <context:component-scan base-package="com.aaa.ssm.service"></context:component-scan>
    <!--创建dbcp数据源连接池对象-->
    <bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
    <property name="url" value="jdbc:oracle:thin:@localhost:1521:orcl"></property>
    <property name="username" value="scott"></property>
    <property name="password" value="tiger"></property>
    </bean>
    <!--创建mybatis的SqlSessionFactory工厂类对象-->
    <bean class="org.mybatis.spring.SqlSessionFactoryBean">
    <property name="dataSource" ref="dataSource"></property>
    <!--指定mapper文件的地址 此处可以使用*号同配置,表示加载包下所有的xml结尾的mapper文件-->
    <property name="mapperLocations" value="classpath:com/aaa/ssm/dao/*.xml"></property>
    </bean>
    <!--配置扫描mybatis的dao接口 ,会为dao接口创建myabtis的dao接口实现类对象,放置到session工厂中-->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!--指定dao接口在哪个包中-->
    <property name="basePackage" value="com.aaa.ssm.dao"></property>
    </bean>

    <!--声明spring 的事物管理器对象-->
    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource"></property>
    </bean>
    <!--声明以注解的方式配置spring 的事物-->
    <tx:annotation-driven transaction-manager="transactionManager"></tx:annotation-driven>
    </beans>
  • 相关阅读:
    luoguP3806 【模板】点分治1
    BZOJ 4176: Lucas的数论 莫比乌斯反演 + 杜教筛
    BZOJ 3994: [SDOI2015]约数个数和 莫比乌斯反演
    CF1037H Security 后缀自动机 + right集合线段树合并 + 贪心
    BZOJ 2226: [Spoj 5971] LCMSum 莫比乌斯反演 + 严重卡常
    BZOJ 4408: [Fjoi 2016]神秘数 主席树 + 神题
    BZOJ 4804: 欧拉心算 欧拉函数
    BZOJ 3930: [CQOI2015]选数 莫比乌斯反演 + 杜教筛
    html基础总结
    对于房天下租房信息进行爬取
  • 原文地址:https://www.cnblogs.com/b6952/p/10939504.html
Copyright © 2011-2022 走看看