[英]can spring roo parse variables in arguments of annotation @javax.validation.constraints.Size?
i have a spring roo application with an entity Book . 我有一个带有实体Book的spring roo应用程序。 the entity has some properties like title where i use a variable ONE_KILO_BYTE as value:
该实体具有一些属性,例如标题 ,其中我使用变量ONE_KILO_BYTE作为值:
public class Book {
private static final int ONE_KILO_BYTE = 1024;
@NotNull
@Size(max = ONE_KILO_BYTE)
private String title;
...
}
the code compiles and works well, but in spring roo shell i get some errors and the corresponding aj file like Book_Roo_Jpa_ActiveRecord.aj can no more be updated by the roo shell. 代码可以编译并运行良好,但是在Spring Roo Shell中我遇到了一些错误,并且Roo Shell无法再更新诸如Book_Roo_Jpa_ActiveRecord.aj之类的相应aj文件。 the error message in spring roo shell looks like this:
spring roo shell中的错误消息如下所示:
org.springframework.roo.model.EnumDetails cannot be cast to java.lang.Integer
when i replace all occurences of ONE_KILO_BYTE with 1024 spring roo is able to generate aj files again. 当我用1024 spring roo替换所有ONE_KILO_BYTE的出现时 ,能够再次生成aj文件。
roo version: 1.2.5.RELEASE roo版本:1.2.5.RELEASE
my problem remembers me a bit of this issue: https://jira.spring.io/browse/ROO-3047 我的问题让我想起了这个问题: https : //jira.spring.io/browse/ROO-3047
is it possible to use constant values in @Size annotation arguments with spring roo? Spring Roo是否可以在@Size注释参数中使用常量值?
It isn't possible. 这是不可能的。 The reason is that Roo MetaModel needs the value for generating code.
原因是Roo MetaModel需要用于生成代码的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.