[英]Failed to start quarkus: java.lang.ArrayIndexOutOfBoundsException: 1
Quarkus application (0.19.1), created from QuarkEE artifact fails to start with: 从QuarkEE工件创建的Quarkus应用程序(0.19.1)无法以以下内容开头:
[io.qua.dev.DevModeMain] Failed to start quarkus: java.lang.ExceptionInInitializerError ..
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at io.quarkus.hibernate.validator.runtime.HibernateValidatorRecorder
EDIT I've opened a ticket for it: https://github.com/quarkusio/quarkus/issues/3284 编辑我为此打开了一张票: https : //github.com/quarkusio/quarkus/issues/3284
Root cause was a bean validation constraint javax.validation.constraints.NotNull
on the static factory method of the enum class. 根本原因是枚举类的静态工厂方法上的bean验证约束javax.validation.constraints.NotNull
。 Simplified example: 简化示例:
public enum Gender {
MALE,
FEMALE;
public static Gender fromCode(@NotNull String code) {
return Gender.valueOf(code);
}
}
and having this dependency in your pom: 并在pom中具有此依赖关系:
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
</dependency>
Confusing thing is that static factory methods on simple POJO class works. 令人困惑的是,简单POJO类上的静态工厂方法有效。
Note I'm aware that validation of static methods is not supported by the Bean Validation specification. 注意我知道Bean验证规范不支持静态方法的验证。 It is just a hint for IDE. 这只是对IDE的提示。
Java EE 8 Validating Constructors and Methods: Bean Validation constraints may be placed on the parameters of nonstatic methods and constructors and on the return values of nonstatic methods. Java EE 8验证构造函数和方法: Bean验证约束可以放置在非静态方法和构造函数的参数上以及非静态方法的返回值上。 Static methods and constructors will not be validated. 静态方法和构造函数将不被验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.