java – javax.validator with spring component

I use javax.validation with Spring. In my test (groovy), I explicitly create a validator.

import javax.validation.Validation
import javax.validation.Validator
import javax.validation.ValidatorFactory

ValidatorFactory factory = Validation.buildDefaultValidatorFactory ()
Validator validator = factory.getValidator ()

Define <ConstraintViolation> constraints = validator.validate (entity)

My validator in java

Public class EntityDynamicValidator implements ConstraintValidator {

groupService groupPrivate service;

public UserDynamicEnumValidator () {

public UserDynamicEnumValidator (GroupService final groupService) {
this.groupService = groupService;

public boolean isValid (final Entity entity, final ConstraintValidatorContext context) {
Something something = groupService.findByValue (entity.getValue ());
// validate all that

I need to spend a spring a service to the validator.