I have a bean defined as below:
public class PostDTO {
@Autowired
private Messages messages;
private String id;
@Size(min = Constant.POST_TITLE_MIN_LEN, max = Constant.POST_TITLE_MAX_LEN, message = messages.get("post.err.title"))
private String title;
}
I want the message
value to be dynamic based on locale. Above code shows The value for annotation attribute Size.message must be a constant expression
error.