I'd like to define a Spring's controller path with a path variable as:
private static final String IDS_REGEX = "[" + EnumSet.allOf(MyIdsEnum.class).stream().map(MyIdsEnum.class::getValue)
.collect(Collectors.joining("|")) + "]";
public static final String MY_PATH = "/path/{id:" + IDS_REGEX + "]}";
And then in my controller:
@PostMapping(value = MY_PATH, produces = MediaType.APPLICATION_JSON_VALUE)
However, IntelliJ throws an error in the PostMapping value:
Attribute value must be constant
The path is already static final, what should I have to do to turn it into a constant?
Thanks in advance