zoukankan      html  css  js  c++  java
  • ssm整合之配置applicationContext-dao.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">

    <!-- 配置 读取properties文件 jdbc.properties -->
    <context:property-placeholder location="classpath:jdbc.properties" />



    <!-- 配置 数据源 -->
    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    <property name="driverClassName" value="${jdbc.driver}" />
    <property name="url" value="${jdbc.url}" />
    <property name="username" value="${jdbc.username}" />
    <property name="password" value="${jdbc.password}" />
    </bean>

    <!-- 配置SqlSessionFactory -->
    <bean class="org.mybatis.spring.SqlSessionFactoryBean">
    <!-- 设置MyBatis核心配置文件 -->
    <property name="configLocation" value="classpath:mybatis/SqlMapConfig.xml" />
    <!-- 设置数据源 -->
    <property name="dataSource" ref="dataSource" />
    </bean>

    <!-- 配置Mapper扫描 -->
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
    <!-- 设置Mapper扫描包 -->
    <property name="basePackage" value="com.itheima.crm.mapper" />
    </bean>

    <!--jdbc.properties的内容

    jdbc.driver=com.mysql.jdbc.Driver
    jdbc.url=jdbc:mysql://localhost:3306/crm-32?characterEncoding=utf-8
    jdbc.username=root
    jdbc.password=123

    -->




    </beans>

  • 相关阅读:
    分布式版本控制系统Git-----5.Git 的push命令总结
    分布式版本控制系统Git-----4.Git 常用命令整理
    分布式版本控制系统Git-----3.图形化Tortoisegit创建本地库并且提交到远程服务器上
    分布式版本控制系统Git-----2.上传至远程仓库之基础版
    分布式版本控制系统Git-----1.Git 初识
    JavaWeb笔记03-Servlet
    JavaWeb笔记01-XML
    Emmet的html语法
    npm常用命令
    Node.js中事件的循环
  • 原文地址:https://www.cnblogs.com/zjj1996/p/9100410.html
Copyright © 2011-2022 走看看