给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文件中&改为&
也就是改为:
<prop key="url">jdbc:mysql://192.168.168.168:3360/gifts?useUnicode=true&characterEncoding=utf-8&useSSL=true</prop>
标签:xml,11,jdbc,characterEncoding,useSSL,mysql,true From: https://www.cnblogs.com/uncleyong/p/16754373.html