Skip to content

jinchunzhao/trim-space

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trim-space

trim-space

项目 介绍

trimSpace是一个使用Spring的拦截器 HandlerInterceptor,对进入controller的字符串参数做通用化去除前后空格处理。

原理

使用反射得到controller入参,并逐一进行甄别是否是字符串类型,进行去除字符串类型前后空格

注意事项

POST请求

支持入参是@RequestBody类型,对象的属性:基本包装类型、对象类型、set、List、Map集合、数组类型 支持入参是@RequestParam 类型 POST请求

支持入参是对象类型接收 支持入参是@RequestParam 类型 支持入参是@PathVariable类型 使用说明

引入依赖 在controller的方法上引入注解@TrimSpace xxxx 扩展

About

Trim - space is a blocker HandlerInterceptor using Spring, generalizing the string into the controller parameters do remove the Spaces before and after treatment

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages