commons-lang3提示“The type StringEscapeUtils is deprecated”

2018-04-05 23:28:52
2967 次阅读
0 个评论

commons-lang3-3.x.jar 这个jar包里面的 org.apache.commons.lang3.StringEscapeUtils 类可以用来转义特殊字符,3.x之版本提示这个类已过时

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


看了下这个类的官方文档,很自然地找到了新的替代类——org.apache.commons.text.StringEscapeUtils

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

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


或者直接去Maven仓库下载这个jar包,下载地址如下


http://central.maven.org/maven2/org/apache/commons/commons-text/1.3/

收藏00

登录后回答。没有帐号?注册一个。