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包,下载地址如下: