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没识别出来,但是为什么呢? 想不通 

  • 相关阅读:
    HTML
    HTML
    HTML
    HTML
    HTML
    HTML
    HTML
    TOMCAT-IDEA远程debug方法
    调整mysql数据库最大连接数
    win10开机时内存使用率达到99%以上
  • 原文地址:https://www.cnblogs.com/zytcomeon/p/15643045.html
Copyright © 2011-2022 走看看