Top Banner

Click here to load reader

of 36

Spring 3의 jsr 303 지원

May 16, 2015

Download

Technology

Sewon Ann
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

2.
JSR 303 (Bean Validation)
JSR 303
JSR 303
Spring 3 JSR 303
Spring 3 JSR 303
Spring MVC JSR 303
2
3. (Validation)
, !

Validation
if( input.getName() == null ||
input.getAddress() == null ||
input.getEmail() == null ) { throw new
Exception(invalid input!);}
3
4. JSR 303 Bean Validation
Java

< >[1]
[1] Hibernate Validator Reference Guide
4
5.
5
< Application- ValidateCar>
!!
doors:must be greater than or equal to 2
name:may not be null
< Car>

6. JSR 303 4
6
7. Constraint Annotation

8. ) 9. 10. 11. 12. 13. Bean (Property) (getter ) 14. ) !7
15. Constraint Annotation

  • Target: Annotation

16. Retention:RUNTIME 17. Constraint: validatedBy Constraint Validation 18. message(): . annotation fully qualified class name + .message 19. groups(): 20. payload(): @Past [1]
[1] JSR 303 Spec
8
21. Constraint Annotation
9
22. Constraint Validation

Constraint Annotation @Constraint( validatdateBy )
Constraint Annotation , Class
) @Past Hibernate Validatororg.hibernate.validator.constraints.impl.PastValidatorForCalendar org.hibernate.validator.constraints.impl.PastValidatorForDate
10
23. Constraint Validation
11

  • javax.validation.ConstraintValidator

24. Constraint Annotation, 25. initialize(): . 26. ) annotation field 27. isValid() : , boolean . ConstraintViolation ConstraintValidatorContext