java - H2 - 发生了非法反射访问操作
问题描述
启动我的 spring-boot 应用程序后出现警告-
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.hibernate.internal.util.ReflectHelper (file:/C:/Users/xxxx/.m2/repository/org/hibernate/hibernate-core/5.3.7.Final/hibernate-core-5.3.7.Final.jar) to field java.lang.String.coder
WARNING: Please consider reporting this to the maintainers of org.hibernate.internal.util.ReflectHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
结果我的表有一个 Coder 列,而不是像我的实体这样的实际名称 -
@Entity
public class TaxValuesEntity {
@EmbeddedId
public String countryCodePK;
public double taxValue;
public Timestamp creationAt;
public Timestamp modifedAt;
protected TaxValuesEntity() {
};
public TaxValuesEntity(String countryCode, double taxValue, Timestamp creation, Timestamp modifed) {
this.countryCodePK = countryCode;
this.taxValue = taxValue;
this.creationAt = creation;
this.modifedAt = modifed;
}
//getters & setters ...
};
感谢您的帮助,如果需要更多代码,请在下面评论。
解决方案
我对 JDK11 和 Mockito 也有类似的问题。解决方法是使用最新版本的 Mockito。也许检查 Hibernate 的版本和 JDK 11 的当前支持状态。在快速搜索中,发现使用带有 jdk11的 hibernate和hibernate 版本 5.4
推荐阅读
- javascript - Angular:在定义之前使用本地引用
- java - 遍历java中的值
- c# - 对于单元测试如何使命名空间派生?
- nginx - 有什么方法可以在 nginx 中仅记录请求/响应的标头大小?
- r - 从 R 中的 data.table 中的值替换数据框中的所有值
- amazon-web-services - 无法使用 Elastic Beanstalk 挂载 EFS
- mysql - 如何阻止在 Tableau 中组合同一维度中的相似值?
- node.js - node-forge 库 crl 分发列表不正确
- c# - 单击 ContentControl 中的按钮的事件
- java - 毕加索图书馆不加载图像 - Android Studio