Bean Validation, previously commonly called just "JSR-303", is an annotation based validation framework for javabean properties and parameters of arbitrary methods. Hibernate Validator is the reference implementation and the most widely used one.
Questions tagged [bean-validation]
1913 questions
0
votes
0 answers
Validation Constraint just work only in a field. Bean Validation API
I have a problem to change validation messages in a form, I've been doing some research and found out about the validation constraints.
First, I wanted to validate that the data were not null, so I used the @NotNull constraint but it doesn't work…

Kaze
- 11
- 4
0
votes
0 answers
what i am asking is, how to handle that binderresult error my custom error that : **Pincode cannot be empty**
Pincode validator class
public class PincodeValidator implements ConstraintValidator {
int size;
@Override
public void initialize(IsValidPincode constraintAnnotation) {
this.size = constraintAnnotation.sizeOfPincode();
}
@Override
public…

SurendraKumar Jaiswal
- 192
- 1
- 17
0
votes
1 answer
javax.validation and composed annoations
I have a group of annotations that are always together like so:
@Valid
@ValidPropertyA(kind = "Standard")
@ValidPropertyB(kind = "Standard")
@ValidPropertyC(kind = "Standard")
private SomeReusableType type;
@Valid
@ValidPropertyA(kind =…

Rcunn87
- 134
- 2
- 10
0
votes
1 answer
JSR303 ConstraintValidator, how to show the message without an error page
Im working with JSF 2.0 and Glassfish v3. I was testing the functionality of JSR303 bean validation, so I created a validator which implements ConstraintValidator and then annotate that on a property wich I want to validate.
It works fine, but it…

eav
- 2,123
- 7
- 25
- 34
0
votes
0 answers
Does Bean validation works on semantics or syntax.?
While reading bean validation specification, I got confused that whether it works on semantics or syntax.
My view is, it works on semantics through its Constraint Validations.
Please correct me or confirm me on my understanding.

Milind Pandey
- 13
- 4
0
votes
1 answer
Spring Boot 2: Duplicate annotation issue when using hibernate-jpamodelgen
I have a simple Spring Boot 2 application using hibernate-jpamodelgen. Here's the entire Maven POM:

Brice Roncace
- 10,110
- 9
- 60
- 69
0
votes
1 answer
Spring JSR-303 ConstraintValidator not support list.add()
I've met such a misundestrood:
I've made a validation using my own annotation @Category and class CategoryValidator implements ConstraintValidator
All is about list.add() which causes (without it works properly):
Request…

ehr
- 143
- 1
- 1
- 12
0
votes
1 answer
Reuse form data class with different validation pattern in Spring controller
I would like to use the same form data class with two diferents controller but with different Validation pattern.
I have class and controller:
public class Query {
@Pattern(regexp = "") //different pattern for askHim and askMe
private String…

Mr.M.
- 78
- 1
- 6
0
votes
1 answer
Dropwizard support for validation in non-Resource classes (JSR-303)
According to this link:
If you need to validate entities outside of resource endpoints, the validator can be accessed in the Environment when the application is first ran.
Which means that the @Valid below won't work and I have to programatically…

cahen
- 15,807
- 13
- 47
- 78
0
votes
1 answer
Java8 Bean Validation for Enum type using Hibernate
Here's my situation,
I have a class with Enum type fields. I want to execute annotated validation for enum types, similar to annotations for strings, example: @Size, @NotNull etc.
Problem is, json deserializer fails on enum type before validation…

Prabhdeep Gill
- 41
- 7
0
votes
2 answers
Spring Boot: How run Bean Validation before Authentication?
I am newbie in Spring Boot.
I'd like to know how can I validate the Credentials DTO before the Authentication in Spring Boot?
I have this controller:
@PostMapping
public ResponseEntity generateTokenJwt(@Valid @RequestBody CredentialsDTO…

Luciano Borges
- 817
- 3
- 12
- 31
0
votes
2 answers
Combining multiple repetitive annotations
I have a couple of json properties which should be handled by multiple aanotations
From design's best practices, should I have multiple repeating annotations (from a standard library) or should I create a customized annotation to handle them…

Mahyar
- 1,011
- 2
- 17
- 37
0
votes
1 answer
Use JAX-303 (bean-validation) annotations with custom type
I have a web application that is using Jersey2 to publish various REST services.
In this project, I am using the javax.validation annotations to validate the various inputs. However, I have some custom data types (Money, Percentage) where I would…

Nathan
- 1,576
- 8
- 18
0
votes
2 answers
Spring's Bindingresult for json Body Containing Nested different kind of Objects
I have a scenario where json request is made of different custom objects like:
{
"person:":{
"name":"xyx",
"age":25
},
"movieList":[
{
"name":"yyy",
"duration":34,
"language":"english"
},
{
…

Prash
- 544
- 8
- 24
0
votes
1 answer
globalOnly="true" in h:messages and bean validation
I use globalOnly="true" in h:messages to show messages as success or errors during bean methods......

Pickles Dog
- 155
- 2
- 11