Spring Boot custom constraint validator with multiple values
You should make your BlockedWithoutEnabledFeatureFlag repeatable. To do this:

Create a new "top-level" annotation:

@Target({ ElementType.FIELD })
@Retention(RetentionPolicy.RUNTIME)
public @interface RepeatableBlockedWithoutEnabledFeatureFlag {
    BlockedWithoutEnabledFeatureFlag[] value();
}


Add @Repeatable to your BlockedWithoutEnabledFeatureFlag annotation

...
@Repeatable(RepeatableBlockedWithoutEnabledFeatureFlag.class)
public @interface BlockedWithoutEnabledFeatureFlag {
...

Then you should be able to add more than one @BlockedWithoutEnabledFeatureFlag annotation.

I want to add 2 values for my custom constraint validator because I have 2 feature flags:
 @JsonProperty(value = "name")
    @BlockedWithoutEnabledFeatureFlag(feature = FeatureFlag.AAA, values = {"aaa", "bbb"})
    @BlockedWithoutEnabledFeatureFlag(feature = FeatureFlag.BBB, values = {"ccc", "ddd"})
    private String parameter;

where:
@Constraint(validatedBy = {BlockedWithoutEnabledFeatureFlagValidator.class})
@Target({FIELD, PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@ReportAsSingleViolation
public @interface BlockedWithoutEnabledFeatureFlag {

    String message() default "{validation.constraints.BlockedWithoutEnabledFeatureFlag.message}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    FeatureFlag feature();

    String[] values() default {};
}

and implementation:
public class BlockedWithoutEnabledFeatureFlagValidator implements ConstraintValidator<BlockedWithoutEnabledFeatureFlag, Object> {
    private final FeatureFlagService featureFlagService;

    private List<String> blocked;
    private FeatureFlag feature;

    @Override
    public void initialize(BlockedWithoutEnabledFeatureFlag constraintAnnotation) {
        blocked = Arrays.asList(constraintAnnotation.values());
        feature = constraintAnnotation.feature();
    }

@Override
    public boolean isValid(Object value, ConstraintValidatorContext context) {


But now I get compilation error "Duplicate annotation". How to do that?
