过去正常的代码,突然报错:
org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/beans/spring-beans-2.0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
解决方法:
1、参照原文链接,转载:https://blog.csdn.net/bluishglc/article/details/7596118
感谢博主分享!
2、原文9楼回复:
主要是需要在<transformers>里面加上下面内容 :
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
博主:确实是这样,这样配置maven-shade-plugin以后查看构建产出的jar包,发现spring.schemas和spring.handlers都正确了。
并且在无外网的环境下能正常启动Spring。