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
1 answer
Validating a List of beans using Bean Validation 2.0 (JSR-308) and Spring 5
Spring 5 is supposed to support Bean Validation 2.0 which introduced validation on List types but I can't seem to get it to work for me.
I have the following endpoint in my @RestController:
@PostMapping("/foos")
public List…

Plog
- 9,164
- 5
- 41
- 66
0
votes
1 answer
How to validate date using Custom date proprty editor in spring MVC
I have made the Date in in my java Class
and this is the code i have used in controller
@InitBinder
public void initBinder(final WebDataBinder binder) {
binder.registerCustomEditor(Date.class, null, new CustomDateEditor(new…
John
0
votes
1 answer
WebLogic deployment succeed with errors
we are upgrading our WebLogic 10 which runs on java 6 to WebLogic 12C which runs on java 8.
initially I couldn't deploy my application on WebLogic 12C. I figured, using following command, that I should update couple of ejb-jar.xml files in my…

Suo6613
- 431
- 5
- 17
0
votes
1 answer
Enabling Bean Validation 2.0?
I was trying to follow the instructions in the article below trying to implement a simple annotation just to test if a string was a certain length as a test. My goal was to have this annotation thrown an exception at runtime if the String doesn't…

soeske18
- 115
- 1
- 6
0
votes
2 answers
JSR303 Validation - Using groups from a custom class validator
We have a use case in which we have a fairly poorly constructed bean that contains fields like so:
public class DataBean {
private boolean flag1;
private boolean flag2;
private String phone1;
private String address1;
private…

bruth
- 61
- 1
- 9
0
votes
1 answer
Bean Validation in Spring Boot Data Rest Not Working
I have a very simple Spring Boot 2.0.3 project using Spring Data Rest.
When I try to add a User with an invalid email address using POST on http:localhost:8080/users, this JSON is returned:
{
"timestamp": "2018-08-07T18:16:15.513+0000",
…

MET
- 21
- 2
0
votes
0 answers
How to validate a DTO only for a specific constraint and ignore the other?
Imagine a case we have such dto
@CheckUserDetailsNotNull
@CheckUserMobileValid
@CheckUserEmailValid
public class UserDto {}
and, ofcourse, for each of these annotations there are dedicated constraint validators, for example for…

Tymur Berezhnoi
- 706
- 1
- 14
- 27
0
votes
1 answer
Custom validator doesn't work (completely) when annotated by composed constraint @NotBlank
I have a custom validator like this:
@Retention(RetentionPolicy.RUNTIME)
@NotBlank(message = "{state.NotBlank}") // Err...it doesn't work
@Constraint(validatedBy = { State.Validator.class })
public @interface State {
String message() default…

x80486
- 6,627
- 5
- 52
- 111
0
votes
1 answer
How to validate annotated with Spring @Value field using custom annotation?
How can i check if "${path}" value is not empty or is correct path and if so, throw some exception? I want to it happen during Bean creation.
All I found that is such validation used in multilayer
apps for user input data validation in @Controller…
0
votes
2 answers
Spring java set id property to start increment from a six digit number
I am new to the Spring framework. In my current project, I have a property of a class that requires the ID to have a minimum of six digits in length.
All the id's must have six digits or more.
I have tried to set the length of the Id to be six…

ben brick
- 31
- 1
- 7
0
votes
0 answers
ValidationMessages stays cached until I restart the websphere application server
My problem is that whenever I update or add any message in the ValidationMessages.properties, those messages won't reflected to the actual runtime validation message until restarting the application server (Just like the file being cached on the…

Mu'ath Baioud
- 41
- 1
- 3
0
votes
1 answer
Springboot request object validation
I have a request object
public class OrderRequest {
private List
detailsList;
}
public class Details{
Private String id;
private List detailList;
}
public class Detail{
@NotNull(message = "Please…

Karthik Suresh
- 367
- 7
- 23
0
votes
1 answer
An exception about Bean Validation caused by Log4j2
I established a Spring Boot project with jersey starter and log4j2 starter as well as added a resource class as below:
@Controller
@Path("test")
public class TestResource {
@POST
public String hello(@Valid Message message) {
return…

Weston Tan
- 21
- 3
0
votes
1 answer
Spring and Hibernate Form Validation Error not show
This is my customer.java class using for as bean
package com.zeeshan.form;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
public class Customer {
private String firstName;
@NotNull(message="is…
0
votes
0 answers
Spring AOP: field validation not working
I have a Jersey resource class which use field validation for header parameter.
@Controller
@RequiredArgsConstructor
public class Resource {
@Min(value = 0)
@HeaderParam("id")
private int id;
@HeaderParam("Authorization")
…

Jun
- 560
- 1
- 6
- 17