GitHub - code4everything/validator: java validator
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
Public archive
Branches
Tags
Go to Branches page Go to Tags page
21 Commits
View commit history for this file.
Repository navigation
validatorPublic archive
About
java validator
Resources
Readme MIT license Activity Custom propertiesStars
0 starsWatchers
0 watchingForks
0 forks Report repositoryBranches
Tags
Go to Branches page Go to Tags page
Latest commit
History
21 Commits
View commit history for this file.
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
| bin | bin | ||
| src | src | ||
| .gitignore | .gitignore | ||
| LICENSE | LICENSE | ||
| README.md | README.md | ||
| pom.xml | pom.xml | ||
Repository files navigation
SpringMvc 参数校验注解扩展包
定义了一些SpringMVC通用的参数校验注解,轻松实现入参的校验,提高接口的健壮性,避免生成一些不必要的脏数据
使用
<repository>
<id>ease-maven</id>
<url>https://code4everything.gitee.io/repository/maven</url>
</repository>
<dependency>
<groupId>org.code4everything</groupId>
<artifactId>validator</artifactId>
<version>1.0.0</version>
</dependency>
校验Body
@Data
public class BodyVO {
@Chinese(has = true)
private String chinese;
@EndWith("suffix")
private String suffix;
}
@RestController
public class TestController {
@GetMapping("/validation/body")
public String validateBody(@Valid @RequestBody BodyVO bodyVO) {
return "success";
}
}
校验参数
@Validated
@RestController
public class TestController {
@GetMapping("/validation/body")
public String validateQueryString(@Letter(lowerCase = true) String letter, @Mobile String phoneNumber) {
return "success";
}
}
About
java validator