• Caused by: org.xml.sax.SAXParseException; lineNumber: 11; columnNumber: 106; 对实体 "characterEncoding" 的引用必须以 ';' 分隔符结尾。


    给Properties注入值报错

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           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.xsd">
        <bean id="stu" class="com.qzcsbj.bean.Student">
            <property name="name" value="jack"/>
            <property name="p">
                <props>
                    <prop key="username">root</prop>
                    <prop key="password">123456</prop>
                    <prop key="url">jdbc:mysql://192.168.168.168:3360/gifts?useUnicode=true&characterEncoding=utf-8&useSSL=true</prop>
                    <prop key="driver">com.mysql.jdbc.Driver</prop>
                </props>
            </property>
        </bean>
    </beans>
    

      

    将xml文件中&改为&amp;

    &是显示结果

    &amp;是转义字符

    也就是改为:

    <prop key="url">jdbc:mysql://192.168.168.168:3360/gifts?useUnicode=true&characterEncoding=utf-8&amp;useSSL=true</prop>

  • 相关阅读:
    C++多态深入分析!
    字符编码总结
    算法:并查集
    树的非递归遍历:一种很好的算法
    算法:快速排序
    算法:堆排序
    字符串匹配:KMP算法, Boyer-Moore算法理解与总结
    shodan搜索
    google hacking 语法
    FOFA的搜索语句
  • 原文地址:https://www.cnblogs.com/uncleyong/p/16754373.html
Copyright © 2020-2023  润新知