【发布时间】:2019-10-02 12:47:10
【问题描述】:
我有一个 bean 定义如下:
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;
}
我希望 message 值根据区域设置是动态的。以上代码显示The value for annotation attribute Size.message must be a constant expression 错误。
【问题讨论】:
-
我可以知道你为什么在 EntityClass 中使用
@Autowired吗?
标签: java spring spring-boot