SpringBoot 參數符號轉義,用這個包下面的類
org.apache.commons.text.StringEscapeUtils
String team = StringEscapeUtils.unescapeHtml4(biUserOrganization.getTeam());
如題所示,之前一直使用commons-lang3-3.x.jar 這個jar包里面的 org.apache.commons.lang3.StringEscapeUtils 類來轉義特殊字符,但是最近發現使用這個類會出現以下提示:
1
2
3
4
|
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包即可解決這個問題:
1
2
3
4
5
|
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.1</version>
</dependency>
|
或者直接去Maven倉庫下載這個jar包,下載地址如下: