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
Include only few package in Maven dependency
I need to include bean-validation API in my java project and I used below maven dependency for same
javax.validation
validation-api
2.0.1.Final
…

user2462959
- 75
- 11
0
votes
1 answer
Spring Boot List of Object Bean Validation
I have a Bean,
@Data
@NoArgsConstructor
public final class PersonRequest {
@NotNull
@JsonProperty("nameList")
private List nameList;
}
and Person POJO,
@Data
public class Sensor {
@NotNull
…

prostý člověk
- 909
- 11
- 29
0
votes
0 answers
Bean validation on associations not working when using generation strategy IDENTITY
I have got the following Parent, Child and Subchild entities:
@Entity
public class Parent {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID", nullable = false, precision = 20)
private Long id;
@Valid
@BatchSize(size =…

René Winkler
- 6,508
- 7
- 42
- 69
0
votes
1 answer
Spring boot application form is not validating on the given validations
@Entity
public class People {
@NotNull
@Size(min = 2, max = 20)
private String name;
@NotNull(message = "Please enter Phone Number")
private long phoneNumber;
//getters and setters
}
For the above model class, my jsp page is…

Hrithik Naha
- 115
- 8
0
votes
1 answer
Unable to Read keys form YAML
I am new to Spring Boot and I am trying to read validation messages from application.yml but unable to do so
here my Model class
@Entity
@Table(name = "users_data")
public class User {
@NotBlank(message = "${errorresponse.useridMissing}")
…

M.Ahsen Taqi
- 965
- 11
- 35
0
votes
1 answer
How to get rid of propertyPath in title attribute Error Response of ConstraintValidatorContext - SpringBoot Custom Validation
I implemented custom validation annotation for a request in Spring Rest Controller which validates if field2 is available in the input request body, then field1 should not be empty. My question is how do I get rid of Field UserInputDTO.userInputDTO…

befocused47
- 34
- 6
0
votes
0 answers
Jersey validation on Client side
We're using Payara 4 server with Jersey version 2.22.2, which is using Moxi for XML and JSON serialization/deserialization. But if necessary we can switch from Moxy to Jackson.
On the server side, meaning in our resource layer that receives the REST…

YevgenyL
- 281
- 3
- 20
0
votes
0 answers
Spring Boot DTO/Payload validation with extra not required fields
In Spring Boot applications, while implementing REST APIs, validation is done of the DTO object received by the server.
We can easily validate the required fields of DTO objects by validation annotations.
But I want to send error response for the…

iamcrypticcoder
- 2,609
- 4
- 27
- 50
0
votes
0 answers
Spring bean validation for empty request body
I have a model class with bean validation constraints (eg. @NotNull, @NotEmpty, ...) for some properties. Everything works fine in terms of validating individual properties, however, when the whole request body is empty, the error will contain only…

Shahin
- 1
- 2
0
votes
1 answer
I can't generate ejbDeploy with Bean Validation
I can't generate the folder ejbDeploy when I am using Bean Validation Annotations. My project use EJB 2.1 and JEE 7 with IBM Websphere Application Server 9. I tried to use Bean Validation in 1.1.0.FINAL and 2.0.0FINAL, but when I am generate the…

Lau13
- 1
0
votes
0 answers
Custom Message with javax.validation.constraints.Future Annotation in Rest Response
I'm trying to present an actual message with a failed validation of an @Future Bean Validation annotation but have been unsuccessful thus far. Here is my current code:
public class ForecastDateVO {
@Future(message = "The forecast date must be in…

risingTide
- 1,754
- 7
- 31
- 60
0
votes
1 answer
vaadin JPAcontainer and nested properties problem
I have entity ExchangeRate {date, currencyFrom, rate} . Entity currencyFrom has properties code and Name. I add it to container addNestedContainerProperty("currencyFrom.code");
it works without problem and code is displayed in vaadin table.
Now I…

Vlada
- 559
- 2
- 11
- 27
0
votes
0 answers
BeanCreationException, NoSuchBeanDefinitionException found for same service jar in feature branch but not in master branch code
I am facing bean creation issue while deploying feature branch. However, same bean is found when building and deploying the master branch code. The only difference in master branch and my feature branch code is few pom file changes related to…

Prajakta
- 89
- 1
- 9
0
votes
0 answers
How to access field value in a JSR message with spring boot 2?
I would like to customize my error message in the following way:
Assume following declaration of a class Person:
@Size(min=10, max=250, message="{size.name}")
private String name;
Within the declared error message in ValidationMessages.properties I…

sateesh466
- 37
- 2
- 10
0
votes
1 answer
Bean validation constraint Pattern: match N digits regexp not working in XML
Bean validation constraint Pattern(match N digits regexp) not working if specified in XML. e.g.,
public class Foo {
@Pattern(regexp="\\d{10}")
private String phoneNumber;
}
phoneNumber: 1234567890
Annotation works.
XML:
…

eastwater
- 4,624
- 9
- 49
- 118