The reference to entity "characterEncoding" mus...

数据源配置时加上编码转换格式后出问题了: mysql

The reference to entity "characterEncoding" must end with the ';' delimiter spring

这个错误就是 context.xml中设置数据源连接URL的问题    sql

<context-param> maven

    <param-name>url</param-name> 编码

    <param-value>jdbc:mysql://localhost:3306/bookstore?useUnicode=true&characterEncoding=UTF-8</param-value> url

</context-param> spa

正确的以下: code

<context-param> xml

    <param-name>url</param-name> ci

    <param-value>jdbc:mysql://localhost:3306/bookstore?useUnicode=true&amp;characterEncoding=UTF-8</param-value>

</context-param>

这大概是由xml文件中的编码规则决定要这么变换。

在xml文件中有如下几类字符要进行转义替换:

&lt;

<

小于号

&gt;

>

大于号

&amp;

&

&apos;

'

单引号

&quot;

"

双引号

 

----------------------------------------------------------------------------------------------------------------

我遇到的问题是使用maven的resouce直接将变量值写到了spring的配置文件中,出现了上述错误。

换到spring的property-placeholder配置资源文件的话就没有问题,据此,估计spring经过配置读取资源文件的话,确定是对上述问题做了处理,具体源码暂时没看

相关文章
相关标签/搜索