关于提示“The type StringEscapeUtils is deprecated”问题的解决

如题所示,之前一直使用`commons-lang3-3.x.jar` 这个jar包里面的 `org.apache.commons.lang3.StringEscapeUtils` 类来转义特殊字符,但是最近发现使用这个类会出现以下提示:

Multiple markers at this line
	- The type StringEscapeUtils is deprecated
	- The method escapeXml11(String) from the type StringEscapeUtils is 
	 deprecated

看提示是说 `StringEscapeUtils` 这个类已经过期了,提醒使用新的替代类。看了下这个类的官方文档,很自然地找到了新的替代类——`org.apache.commons.text.StringEscapeUtils`

因此,使用Maven引用相应的jar包即可解决这个问题:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-text</artifactId>
    <version>1.9</version>
</dependency>

或者直接去Maven仓库下载这个jar包,下载地址如下:http://mvnrepository.com/artifact/org.apache.commons/commons-text/1.1

参考链接


关于提示“The type StringEscapeUtils is deprecated”问题的解决

发布者

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注