org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:工厂方法'requestMappingHandlerAdapter'抛出异常;嵌套异常是 java.lang.NoClassDefFoundError: 无法初始化类 org.springframework.http.converter.xml.SourceHttpMessageConverter
根本原因是
java.lang.ClassCastException:无法将 org.springframework.http.converter.xml.SourceHttpMessageConverter$$Lambda$1320/1372257576 转换为 org.xml.sax.EntityResolver
当通过surefire运行单元测试时会发生这种情况,春季版本是5.0.13.RELEASE。
春天的错误代码是
private static final EntityResolver NO_OP_ENTITY_RESOLVER =
(publicId, systemId) -> new InputSource(new StringReader(""));
不太确定这是怎么发生的。有没有人见过这个?