zoukankan      html  css  js  c++  java
  • springmvc学习指南 之第37篇 记录一下druil连接池配置报错问题

    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"
           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">
        <context:property-placeholder location="classpath:db.properties"/>
        <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    
            <property name="url" value="${abc.url}"/>
            <property name="driverClassName" value="${abc.driver}"/>
            <property name="username" value="${abc.username}"/>
            <property name="password" value="${abc.password}"/>
            <!-- 配置初始化大小、最小、最大 -->
            <property name="initialSize" value="1" />
            <property name="minIdle" value="1" />
            <property name="maxActive" value="10" />
        </bean>
        <bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">
            <property name="dataSource" ref="dataSource"/>
            <property name="typeAliasesPackage" value="com.zyt.po"/>
            <property name="mapperLocations" value="classpath:/mapping/*Mapper.xml"/>
        </bean>
        <!-- 4、定义mapper接口扫描器 -->
        <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
            <!-- 扫描所有XxxMapper接口,将接口实例的创建交给spring容器 -->
            <property name="basePackage"
                      value="com.zyt.dao"/>
        </bean>
    </beans>
    db.properties的内容为
    abc.driver=com.mysql.cj.jdbc.Driver
    abc.url=jdbc:mysql://localhost:3306/msb_dongbao_test?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
    abc.username=root
    abc.password=root

    进行测试成功的,如果将

    配置为

        <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource">
    
            <property name="url" value="${url}"/>
            <property name="driverClassName" value="${driver}"/>
            <property name="username" value="${username}"/>
            <property name="password" value="${password}"/>
            <!-- 配置初始化大小、最小、最大 -->
            <property name="initialSize" value="1" />
            <property name="minIdle" value="1" />
            <property name="maxActive" value="10" />
        </bean>

    看样子好像是username没识别出来,但是为什么呢? 想不通 

  • 相关阅读:
    jQuery
    基于Js实现的UrlEncode和UrlDecode函数代码
    利用缓存、Timer间隔时间发送微信的实例,很有用的例子
    VisualStudio 自动排版等 快捷键
    正则表达式判断手机号码属于哪个运营商
    .Net常用方法汇总
    .NET中的三种Timer的区别和用法
    C# List和String互相转换
    Tempdb--TempDB Basic
    Tempdb--查看tempdb使用的脚本
  • 原文地址:https://www.cnblogs.com/zytcomeon/p/15643045.html
Copyright © 2011-2022 走看看