SpringBoot 字符过滤器

Step 1. Add the JitPack repository to your build file (添加 JitPack 库到 pom.xml 文件中)

<repositories><repository><id>jitpack.ioid><url>https://jitpack.iourl>repository>
repositories>

Step 2. Add the dependency (在 pom.xml 添加 filter 依赖)

<dependency><groupId>com.github.doudiogroupId><artifactId>spring-boot-starter-filter-securityartifactId><version>2.0.0-SNAPSHOTversion>
dependency>

Step 3. Add enable to springboot boot class (SpringBoot 启动类上添加注解)

@SpringBootApplication
@EnableSecurityCESFilter
public class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);}}

在这里插入图片描述

annotation ( 注解 )effect ( 作用 )
@EnableCorsFilterCross domain filter ( 跨域过滤器 )
@EnableSpaceFilterSpace character filter ( HTML4特殊字符过滤器 )
@EnableEscapeHtml4FilterSpecial character filter ( 前后空格过滤器 )

Step 4. Configuration (可用配置)

# 跨域过滤器 添加 header
#doudio:
#  filter:
#    cors:
#      headerMap:
#        Access-Control-Max-Age: 666# HTML4特殊字符过滤器 配置排除的 URL
#doudio:
#  filter:
#    escape:
#      excludeUrl:
#        - /excludeUrl# 前后空格过滤器 配置排除的 URL
#doudio:
#  filter:
#    space:
#      excludeUrl:
#        - /excludeUrl

在这里插入图片描述


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部