My question is a duplicate of Custom annotation with spring security but it went unanswered and I believe there should be a simple solution to the problem.
Basically ins
I did that way :
1 - Define your enum referencing a public final static String "VALUE" like this
public enum MyEnum {
ENUM_A(Names.ENUM_A);
private String value;
private MyEnum (String value) {
this.value = value;
}
public static class Names {
public final static String ENUM_A = "ENUM_A";
}
}
2 - Concat MyEnum values in @PreAuthorize
@PreAuthorize("hasPermission('myDomain', '"+ MyEnum.Names.ENUM_A+"')")