Spring. Creating a Custom Java Annotaiton
package com.luv2code.springmvcdemo.validation ; import javax.validation. Constraint ; import javax.validation.Payload ; import java.lang.annotation.ElementType ; import java.lang.annotation. Retention ; import java.lang.annotation.RetentionPolicy ; import java.lang.annotation. Target ; @Constraint (validatedBy = CourseCodeConstraintValidator . class ) @Target ({ ElementType . METHOD , ElementType . FIELD }) @Retention ( RetentionPolicy . RUNTIME ) public @ interface CourseCode { // define default course code public String value () default "LUV" ; // define default error message public String message () default "must start with LUV" ; // define default groups public Class <?>[] groups () default {} ; // define default payloads public Class <? extends Payload >[] payload () default {} ; } package com.luv2code.springmvcdemo.validation ; import javax.validation.ConstraintValidator ; import javax.validation.ConstraintValidato...