RestSpringMVCDemo
RestSpringMVCDemo项目是一个基于Spring的符合REST风格的项目,具有MVC分层结构并实现前后端分离。该项目体现了一个具有REST风格项目的基本特征,即具有统一响应结构、 前后台数据流转机制(HTTP消息与Java对象的互相转化机制)、统一的异常处理机制、参数验证机制、Cors跨域请求机制以及鉴权机制。
- 336
- Java
- 8 y ago
A library that extends the Java Bean Validation with additional @Annotations.
Repo nomemory/java-bean-validation-extension, read from GitHub 2 d ago. nomemory has not joined Take My Repo.
nomemory/java-bean-validation-extension is a public repo on GitHub by nomemory. A library that extends the Java Bean Validation with additional @Annotations. It declares the Apache-2.0 license on GitHub. It is written mainly in Java, has 129 stars and last changed on 2021-04-20. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-20.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
JBVE (Java Bean Validation Extension) is a small utils library that extends the Java Bean Validation Specification with additional @Annotations.
If you are not familiar with JSR-380 (or the Java Bean Validation Specification) please follow this nice tutorial first.
If you want to see JVBExt at work please:
For versions (>=0.0.12):
<dependency>
<groupId>net.andreinc</groupId>
<artifactId>jbve</artifactId>
<version>0.0.12</version>
</dependency>
Important note(s):
In the runtime environment you will an existing JSR-380 implementation in the classpath. Spring Boot started web comes by default with Hibernate Validator.
If you are using the library in another environment that doesn't provide a JSR-380 implementation you will need to add the following as dependencies:
compile group: 'org.hibernate', name: 'hibernate-validator', version: '6.0.2.Final'
compile group: 'org.glassfish', name: 'javax.el', version: '3.0.1-b08'
Java Bean Validation Extension was downloaded +/-450 times since October, 2017.
If you are using jbvext in your cool projects please send me a note so I can include you in this list.
| @Annotation | Supported Types | Description |
|---|---|---|
@After |
Date |
Check if the Date is after the given date value, with date format as parameter. |
@Alpha |
String |
Checks if the String contains only unicode letters. |
@Alphanumeric |
String |
Checks if the String contains unly unicode letters or digits |
@AlphanumericSpace |
String |
Checks if the String contains only unicode letters, digits, empty strings or spaces. |
@AlphaSpace |
String |
Checks if the String contains only Unicode letters and space " ". |
@AsciiPrintable |
String |
Checks if the String contains only ASCII printable characters. |
@Blank |
String |
Checks if the String is empty "", null or whitespace(s) " " only. |
@Before |
Date |
Check if the Date is before the given date value, with date format as parameter. |
@CC |
String |
Checks if the String is a valid credit card number. |
@EndsWith |
String |
Checks if the Strings ends with a specified suffix(es). |
@InstanceOf |
Object |
Check if the Object is an instanceof of (at least one of) the supplied value(s). |
@IPv4 |
String |
Checks if the String is a valid IPv4 address. |
@IPv6 |
String |
Checks if the String is a valid IPv6 address. |
@IsDate |
String |
Check if the String is in a date format. |
@LowerCase |
String |
Checks if the String contains only lowercase letters. |
@MinDigits |
Double |
Checks whether the annotated value is higher than or equal to the specified minimum. |
@MaxDigits |
Double |
Checks whether the annotated value is less than or equal to the specified maximum. |
@NotInstanceOf |
Object |
Check if the is not an instanceof of (all the) the supplied value(s). |
@Numeric |
String |
Checks if the String contains only unicode digits. Note: A decimal point is not considered a digit and the validation fails. Use @Parseable instead for more advanced validations. |
@OneOfChars |
Character |
Checks if the Character is contained in a given array (char[]) of values. |
@OneOfDoubles |
Double |
Check if the Double is contained in a given array (double[]) of values. |
@OneOfIntegers |
Integer |
Check if the Integer is contained in a given array (int[]) of values. |
@OneOfLongs |
Long |
Check if the Long is contained in a given array (long[]) of values. |
@OneOfStrings |
String |
Checks if the String is contained in a given array (String[]) of values. |
@Parseable |
String |
Checks if the String can be parsed to a number (Short, Integer, Long, Double, etc.). |
@Password |
String |
Checks if the String is a valid password. |
@StartsWith |
String |
Checks if the String starts with the specified prefix(es). |
@UpperCase |
String |
Checks if the String contains only uppercase letters. |
Note:
All the examples are using project's lombok annotations like @Data, @NoArgsConstructor, @AllArgsConstructor, etc.
Those annotations are used make the examples more compact, but their use is optional.
@AfterCheck if the Date is after the given date value.
The annotation supports a second property format that by default is "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
@Data
class AfterBean {
@After(value = "2018-01-01", format = "yyyy-MM-dd")
private Date isAfter = new Date(1522399999911L); // Passes // Date = 2018-03-30
}
@AlphaCheck if the String contains only unicode letters.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:x: Fails |
" " |
:x: Fails |
"abc" |
:white_check_mark: Passes |
"ab2c" |
:x: Fails |
"ab-c" |
:x: Fails |
@Data
class TestAlpha {
@Alpha
private String alpha = "abc";
@Alpha /** Will fail */
private String nonAlpha = "pr�s-*";
}
@AlphanumericChecks if the String contains only unicode letters or digits.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:x: Fails |
" " |
:x: Fails |
"abc" |
:white_check_mark: Passes |
"ab c" |
:x: Fails |
"ab2c" |
:white_check_mark: Passes |
"ab-c" |
:x: Fails |
@AlphanumericSpaceChecks if the String contains only unicode letters, digits, empty strings or spaces.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:white_check_mark: Passes |
" " |
:white_check_mark: Passes |
"abc" |
:white_check_mark: Passes |
"ab c" |
:white_check_mark: Passes |
"ab2c" |
:white_check_mark: Passes |
"ab-c" |
:x: Fails |
@AlphaSpaceChecks if the String contains only Unicode letters and space (" ").
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:white_check_mark: Passes |
" " |
:white_check_mark: Passes |
"abc" |
:white_check_mark: Passes |
"ab c" |
:white_check_mark: Passes |
"ab1c" |
:x: Fails |
"ab-c" |
:x: Fails |
@AsciiPrintableChecks if the String is printable (ASCII printable characters).
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:white_check_mark: Passes |
" " |
:white_check_mark: Passes |
"\u0020" |
:white_check_mark: Passes |
"\u007e" |
:x: Fails |
"G\u00fclc\u00fc" |
:x: Fails |
@BeforeCheck if the Date is before the given date value.
The annotation supports a second property format that by default is "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
@Data
class BeforeBean {
@Before(value = "2018-12-01", format = "yyyy-MM-dd")
private Date isBefore = new Date(1522399999911L); // Passes // Date = 2018-03-30
}
@BlankChecks if the String is empty "", null or whitespace(s) " " only.
Behavior:
| Value | Result |
|---|---|
null |
:white_check_mark: Passes |
"" |
:white_check_mark: Passes |
" " |
:white_check_mark: Passes |
"abc" |
:x: Fails |
" abc " |
:x: Fails |
@CCChecks if the String is a valid credit card number. Supported types are defined in the CreditCardType enum:
Multiple credit card types can be supplied to the @CC annotation.
@Data
class Account {
@CC({ AMEX, VISA }) // AMEX or VISA
private String ccNumber;
}
Multiple credit card types can be used.
@EndsWithChecks if the String endsWith a list of given suffix(es). If multiple suffixes are supplied, the relationship between them is OR(eg.: endsWith(prefix1) OR endsWith(prefix2) OR ...).
The annotation supports a second property ignoreCase that by default is false.
Behavior (ignoreCase==false):
| Value | Suffix | Result |
|---|---|---|
null |
"abc" | :x: Fails |
"abcdef" |
"def" |
:white_check_mark: Passes |
"ABCDEF" |
"def" |
:x: Fails |
"ABCDEF" |
"" |
:white_check_mark: Passes |
Behavior (ignoreCase==true)
| Value | Suffix | Result |
|---|---|---|
null |
"abc" | :x: Fails |
"abcdef" |
"def" |
:white_check_mark: Passes |
"ABCDEF" |
"def" |
:white_check_mark: Passes |
"ABCDEF" |
"" |
:white_check_mark: Passes |
@Data
@AllArgsConstructor
@NoArgsConstructor
class SomeStrings {
private List<@EndsWith({"1", "2"}) String> someStrings;
}
In the above example we validate all the contents of someStrings so that they end with either 1 or 2.
@InstanceOfTests if an object is instance of the supplied classes.
@Data class Animal {}
@Data class Dog extends Animal {}
@Data class Cat extends Animal {}
@Data class Horse extends Animal {}
@Data
@AllArgsConstructor
class Pets {
/** This should contain only Cats and Dogs as pets, and doesn't contain null */
List<@NotNull @InstanceOf({Dog.class, Cat.class}) Animal> pets;
}
In order to test the above code we need something like this:
Animal aDog = new Dog();
Animal aCat = new Cat();
Pets pets = new Pets(asList(aDog, aCat));
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<Pets>> validations = validator.validate(pets);
// Should return 0 because the Pets class doesn't have any validation issues.
System.out.println(validations.size());
@IPv4Checks if the given string is a valid IPv4 address.
This is implemented using InetAddressValidator.class from Apache Common Validator.
@IPv6Checks if the given string is a valid IPv6 address.
This is implemented using InetAddressValidator.class from Apache Common Validator.
@IsDateChecks if the given string is formatted as a date.
@Data
class IsDateBean {
@IsDate("yyyy-MM-dd")
private String isDate = "2018-12-01"; // Passes
}
@LowerCaseChecks if the String contains only lowercase letters.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:x: Fails |
" " |
:x: Fails |
"abc" |
:white_check_mark: Passes |
"abC" |
:x: Fails |
"ab c" |
:x: Fails |
"ab1c" |
:x: Fails |
"ab-c" |
:x: Fails |
@MinDigitsChecks whether the annotated value is higher than or equal to the specified minimum.
@Data
class MinDigitsDoubleBean {
@MinDigits(value = "10.5")
private Double isOk = new Double(11.0); // Passes
@MinDigits(value = "10.5")
private Double isKo = new Double(10.0); // Do not Pass
}
Double
TODO Add support for more types
@MaxDigitsChecks whether the annotated value is less than or equal to the specified maximum.
@Data
class MaxDigitsDoubleBean {
@MaxDigits(value = "10.5")
private Double isKo = new Double(11.0); // Do not Pass
@MaxDigits(value = "10.5")
private Double isOk = new Double(10.0); // Passes
}
Double
TODO Add support for more types
@NotInstanceOfTest if an object is not an instance of any of the supplied classes.
@Data class Animal {}
@Data class Dog extends Animal {}
@Data class Cat extends Animal {}
@Data class Horse extends Animal {}
@Data
@AllArgsConstructor
class Horses {
/** This should contain only horses and doesn't contain NULL */
List<@NotNull @NotInstanceOf({Dog.class, Cat.class}) Animal> horses;
}
@NumericChecks if a String contains only Unicode digits. A decimal point is not an unicode digit and thus, the validation fails.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:x: Fails |
" " |
:x: Fails |
"123" |
:white_check_mark: Passes |
"\u0967\u0968\u0969" |
:white_check_mark: Passes |
"12 3" |
:x: Fails |
"12a3" |
:x: Fails |
"12-3" |
:x: Fails |
@ParseableCheck if the String can be parsed to a number. The annotations accepts the type of parsing you want to perform as an input parameter.
For example if you want to parse it Integer, @Parseable(TO_INT) should be used.
All the possible parsing strategies accepted are described in the enum ParseableType. It currently supports:
TO_SHORT TO_INTTO_LONGTO_FLOATTO_DOUBLE@PasswordCheck if a String is a valid password - matching a set of constraints.
containsUpperCase() default true - Needs to contain at least an Uppercase letter;boolean containsLowerCase() default true - Needs to contain at least a Lowercase letter;boolean containsSpecialChar() default true - Needs to contain at least one special character;boolean containsDigits() default true - Needs to contain at least one digit;boolean allowSpace() default false - Password can contain spaces;int minSize() default 8 - The min size of the password;int maxSize() default 32 - The maximum size of the password;@OneOfCharsChecks if the Character is contained in a given array (char[]) of values.
In the following example we test if the field aOrBOrC is either 'a', 'b' or 'c'.
@Data
class {
@OneOfChars({'a', 'b', 'c'})
private Character aOrBOrC;
}
@OneOfDoublesCheck if the Double is contained in a given array (double[]) of values.
In the following example we test if the field value is either 1.0 or 2.0.
@Data
class {
@OneOfDoubles({1.0, 2.0})
private Double value;
}
@OneOfIntegersCheck if the Integer is contained in a given array (int[]) of values.
In the following example we test if the field value is either 1 or 2.
@Data
class {
@OneOfIntegers({1, 2})
private Integer value;
}
@OneOfLongsCheck if the Long is contained in a given array (long[]) of values.
@OneOfStringsChecks if the String is contained in a given array (String[]) of values.
In the following example we check if the value returned by the getValue() getter is either "A", "B" or "C".
class Test {
@OneOfStrings({ "A" , "B", "C"})
private String getValue() { return /***/ }
}
@StartsWithChecks if a String starts with the specified prefix(es).
The annotation supports a second property ignoreCase that by default is false.
Behavior (ignoreCase==false):
| Value | Prefix | Result |
|---|---|---|
null |
"abc" | :x: Fails |
"abcdef" |
"abc" |
:white_check_mark: Passes |
"ABCDEF" |
"abc" |
:x: Fails |
"ABCDEF" |
"" |
:white_check_mark: Passes |
Behavior (ignoreCase==true):
| Value | Prefix | Result |
|---|---|---|
null |
"abc" | :x: Fails |
"abcdef" |
"abc" |
:white_check_mark: Passes |
"ABCDEF" |
"abc" |
:white_check_mark: Passes |
"ABCDEF" |
"" |
:white_check_mark: Passes |
@Data
class Starters {
private List< @StartsWith("1", "2") String> starts;
}
@UpperCaseChecks if the String contains only uppercase letters.
Behavior:
| Value | Result |
|---|---|
null |
:x: Fails |
"" |
:x: Fails |
" " |
:x: Fails |
"ABC" |
:white_check_mark: Passes |
"aBC" |
:x: Fails |
"A C" |
:x: Fails |
"1AB" |
:x: Fails |
"A-C" |
:x: Fails |
nomemory/java-bean-validation-extension is a public repo on GitHub by nomemory. A library that extends the Java Bean Validation with additional @Annotations.
It declares the Apache-2.0 license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2021-04-20. GitHub counts 5 open issues and pull requests. Take My Repo does not judge from that whether it is maintained.
RestSpringMVCDemo项目是一个基于Spring的符合REST风格的项目,具有MVC分层结构并实现前后端分离。该项目体现了一个具有REST风格项目的基本特征,即具有统一响应结构、 前后台数据流转机制(HTTP消息与Java对象的互相转化机制)、统一的异常处理机制、参数验证机制、Cors跨域请求机制以及鉴权机制。
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Reverse engineer anything with agents, from app behavior down to native binaries.
deftERP - Jakarta EE Web Profile (Java EE 7 : JSF, JPA, EJB, CDI, Bean Validation)

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发