编程语言
首页 > 编程语言> > java – org.springframework.cglib.core.ReflectUtils $1的非法反射访问

java – org.springframework.cglib.core.ReflectUtils $1的非法反射访问

作者:互联网

我的JDK 9 181 Spring Boot 2.0.0.BUILD-SNAPSHOT CLI应用程序在启动时显示此警告:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.springframework.cglib.core.ReflectUtils$1 (jar:file:/home/jan/src/fm-cli/target/fm-cli-0.1.0-SNAPSHOT.jar!/BOOT-INF/lib/spring-core-5.0.0.RELEASE.jar!/) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of org.springframework.cglib.core.ReflectUtils$1

这是一个控制台应用程序,所以我需要禁用此警告 – 我该怎么做?

注意:此问题询问如何禁用Spring触发此警告的具体问题;它不是JDK9: An illegal reflective access operation has occurred. org.python.core.PySystemState的副本,它处理不同库中的类似症状.

解决方法:

在JDK 9中,将以下选项添加到JVM以禁用Spring使用CGLIB的警告:

--add-opens java.base/java.lang=ALL-UNNAMED

例如:

java --add-opens java.base/java.lang=ALL-UNNAMED -jar target/*.jar

无需报告;这是一个known Spring bug.

发生这种情况是因为新的JDK 9模块系统检测到非法访问,该访问将在(近)未来的某个时间被禁止.您可以阅读有关the JDK 9 Module system here的更多信息.

更新:

JDK 9与Spring 5.1一起解决了这个问题.

标签:java-module,java,spring,spring-boot,java-9
来源: https://codeday.me/bug/20190930/1834680.html