今天在Spring整合的过程中,遇到了个很奇怪的问题,打印的错误日志如下:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0' defined in URL [file:/Users/lijie/java_web/student_manager/out/artifacts/student_manager_war_exploded/WEB-INF/classes/spring-mvc-servlet]: Initialization of bean failed; nested exception is java.lang.NullPointerException;
...
java.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistryjava.lang.IllegalStateException: Expected raw type form of org.springframework.web.servlet.handler.AbstractHandlerMethodMapping$MappingRegistry
经过排查,引起的原因是用了AspectJ 1.8.10这个包。这个是jar包内部的错误,回退到前一个版本就ok了。
具体可以参考:https://jira.spring.io/browse/SPR-15019
http://www.th7.cn/Program/java/201701/1087660.shtml