The following error was encountered when the Spring Boot application was started:
|
|
The reason for the error is that the JVM’s java.base module does not open the java.lang package deep reflection API call permissions for unnamed modules.
Specifically, the setAccessible(true)
API is not open.
This problem is easily encountered in JDK 8 and above. The workaround is to start the Java application with a parameter specifying that a specific module/package
is open, so that the unnamed module
can access the deep reflection API under the specified package
.
If there are multiple Packages that need to open the deep reflection API, then you can specify multiple --add-opens
arguments.
|
|
For example, when starting a Spring Boot application from the command line, you can add multiple --add-opens
arguments.
|
|
My SpringBoot version is 2.6.7, the code is compiled with JDK version 11, and the runtime JDK version is 17.
Oracle Java’s official documentation has instructions for this.
Reference https://blog.csdn.net/davidullua/article/details/125190152