报错摘要:
java.lang.IllegalStateException: Cannot load configuration class: com.imooc.demo.DemoApplication,
Caused by: java.lang.ExceptionInInitializerError: null,
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected
一、背景:
一周前电脑坏掉了,修好之后之前的spring boot项目起不起来了,报上述错误,搞了一天,解决。
二、方法如下:
在启动项的VM options配置中新增:--add-opens java.base/java.lang=ALL-UNNAMED
三、原因:
JDK9以上模块不能使用反射去访问非公有的成员/成员方法以及构造方法,除非模块标识为opens去允许反射访问。否则会产生非法反射警告。
具体可参考文章:https://www.cnblogs.com/linxuannihao/p/16193344.html
- IllegalStateException DemoApplication configuration SpringBoot 项目illegalstateexception demoapplication configuration demoapplication line configuration for illegalstateexception dashboardapplication configuration 项目springboot configure idea illegalstateexception springboot invocation configuration springboot bean springboottest springboot datasource configure attribute 数据源datasource springboot configure demoapplication 注解configuration springboot