xml是:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd"> <dubbo:application name="platform_system_provider" owner="platform_system_provider" organization="llk" logger="slf4j" />
...
java
package com.example.test_dubbo; import org.apache.commons.collections.map.MultiValueMap; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.PropertyValue; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanFactory; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.core.io.FileSystemResource; import java.util.*; public class DubboXmlDetectorL { public static void main(String[] args) { String dubboXML = "E:\dev\erdp2\erdp_system\erdp_system_app\src\main\resources\dubbo.xml"; String dubboXML2 = "E:\dev\ppm\platform_system\02_Src\platform_system\platform_system_provider\src\main\resources\dubbo-provider.xml"; compareDubboXml(dubboXML, dubboXML2); } private static void compareDubboXml(String dubboXML, String dubboXML2) { System.out.println("left = " + dubboXML); Set list1 = getDobboXml(dubboXML); System.out.println("right = " + dubboXML2); Set list2 = getDobboXml(dubboXML2); System.out.println("left = " + list1); System.out.println("right = " + list2); Set set2 = new HashSet(list1); list1.removeAll(list2); System.out.println("list111 = " + list1); list2.removeAll(set2); System.out.println("list222 = " + list2); } private static Set getDobboXml(String dubboXML) { XmlBeanFactory xmlBeanFactory = new XmlBeanFactory(new FileSystemResource(dubboXML)); String[] beanDefinitionNames = xmlBeanFactory.getBeanDefinitionNames(); MultiValueMap multiValueMap = new MultiValueMap(); for (int i = 0; i < beanDefinitionNames.length; i++) { String beanDefinitionName = beanDefinitionNames[i]; BeanDefinition beanDefinition = xmlBeanFactory.getBeanDefinition(beanDefinitionName); Class<? extends BeanDefinition> aClass = beanDefinition.getClass(); Object anInterface = beanDefinition.getAttribute("interface"); // System.out.println("anInterface = " + anInterface); MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); PropertyValue anInterface1 = propertyValues.getPropertyValue("interface"); if (anInterface1 != null) { String interfaceProp = (String) anInterface1.getValue(); PropertyValue version = propertyValues.getPropertyValue("version"); PropertyValue group = propertyValues.getPropertyValue("group"); String key = interfaceProp;//+":"+ (version==null?"":version.getValue())+ ":" + (group==null?"":group.getValue()); if (multiValueMap.containsKey(key)) { } multiValueMap.put(key, beanDefinitionName); } } Set set = multiValueMap.entrySet(); for (Iterator iterator = set.iterator(); iterator.hasNext(); ) { Object entry = iterator.next(); if (entry instanceof Map.Entry) { ArrayList value = (ArrayList) ((Map.Entry) entry).getValue(); if (value.size() > 1) { System.out.println(" = " + entry ); } } } return multiValueMap.keySet(); } private static void test1() { String xmls = "E:\dev\erdp2\erdp_discuss\erdp_discuss_app\src\main\resources\dubbo.xml " + "E:\dev\erdp2\erdp_doc\erdp_doc_app\src\main\resources\dubbo.xml " + "E:\dev\erdp2\erdp_project\erdp_project_app\src\main\resources\dubbo.xml " + "E:\dev\erdp2\erdp_scheduler\erdp_scheduler_app\src\main\resources\dubbo.xml " + "E:\dev\erdp2\erdp_system\erdp_system_app\src\main\resources\dubbo.xml " + "E:\dev\erdp2\erdp_workflow\erdp_workflow_app\src\main\resources\dubbo.xml"; String[] split = xmls.split(" "); for (int i = 0; i < split.length; i++) { String s = split[i]; System.out.println("XML = " + s); detectDobboXml(s); } String dubboXML = "E:\dev\erdp2\erdp_doc\erdp_doc_app\src\main\resources\dubbo.xml"; dubboXML = "dubbo.xml"; dubboXML = "E:\dev\erdp2\test_nacos\src\test\java\dubbo.xml"; // detectDobboXml(dubboXML); } private static void detectDobboXml(String dubboXML) { XmlBeanFactory xmlBeanFactory = new XmlBeanFactory(new FileSystemResource(dubboXML)); String[] beanDefinitionNames = xmlBeanFactory.getBeanDefinitionNames(); // DefaultListableBeanFactory bdr = new DefaultListableBeanFactory(); // bdr.set // XmlBeanDefinitionReader xmlBeanDefinitionReader = new XmlBeanDefinitionReader(bdr); // NamespaceHandlerResolver namespaceHandlerResolver = xmlBeanDefinitionReader.getNamespaceHandlerResolver(); // System.out.println("namespaceHandlerResolver = " + namespaceHandlerResolver); // NamespaceHandlerResolver nsr = new DefaultNamespaceHandlerResolver(); // xmlBeanDefinitionReader.setNamespaceHandlerResolver(nsr); MultiValueMap multiValueMap = new MultiValueMap(); for (int i = 0; i < beanDefinitionNames.length; i++) { String beanDefinitionName = beanDefinitionNames[i]; // System.out.println("beanDefinitionName = " + beanDefinitionName); BeanDefinition beanDefinition = xmlBeanFactory.getBeanDefinition(beanDefinitionName); // System.out.println("beanDefinition = " + beanDefinition); Class<? extends BeanDefinition> aClass = beanDefinition.getClass(); Object anInterface = beanDefinition.getAttribute("interface"); // System.out.println("anInterface = " + anInterface); MutablePropertyValues propertyValues = beanDefinition.getPropertyValues(); PropertyValue anInterface1 = propertyValues.getPropertyValue("interface"); // System.out.println("anInterface1 = " + anInterface1); // propertyValues.getPropertyValueList(); if (anInterface1 != null) { String interfaceProp = (String) anInterface1.getValue(); PropertyValue version = propertyValues.getPropertyValue("version"); PropertyValue group = propertyValues.getPropertyValue("group"); String key = interfaceProp+":"+ (version==null?"":version.getValue())+ ":" + (group==null?"":group.getValue()); // System.out.println("aClass = " + aClass); if (multiValueMap.containsKey(key)) { // multiValueMap.put(interfaceProp, beanDefinitionName); // System.out.println("beanDefinitionName = " + beanDefinitionName + " interface = " + interfaceProp); // System.out.println(" interface = " + interfaceProp + " beanDefinitionNames = " + multiValueMap.get(interfaceProp)); } multiValueMap.put(key, beanDefinitionName); // multiValueMap.put(interfaceProp, aClass); } } // Object dubbo = xmlBeanFactory.getBean("dubbo"); // System.out.println("dubbo = " + dubbo); // BeanDefinition dubbo1 = xmlBeanFactory.getBeanDefinition("dubbo"); // System.out.println("dubbo1 = " + dubbo1.getClass()); Set set = multiValueMap.entrySet(); for (Iterator iterator = set.iterator(); iterator.hasNext(); ) { Object entry = iterator.next(); // System.out.println("entry = " + entry + " v " + multiValueMap.get(entry)); if (entry instanceof Map.Entry) { ArrayList value = (ArrayList) ((Map.Entry) entry).getValue(); // System.out.println("value = " + value.size()); if (value.size() > 1) { System.out.println(" = " + entry ); } } // Collection collection = multiValueMap.getCollection(entry); // if (collection != null && collection.size() > 1) { // System.out.println("key = " + entry); // dumpCollection(collection); // } } // Collection values = multiValueMap.values(); // System.out.println("values = " + values); } private static void dumpCollection(Collection values) { for (Iterator iterator = values.iterator(); iterator.hasNext(); ) { Object next = iterator.next(); System.out.println("next = " + next); } } private static void test() { String dubboXML = "E:\dev\erdp2\erdp_doc\erdp_doc_app\src\main\resources\dubbo.xml"; dubboXML = "dubbo.xml"; ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext( new String[]{dubboXML}); context.start(); ConfigurableListableBeanFactory beanFactory = context.getBeanFactory(); String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames(); for (int i = 0; i < beanDefinitionNames.length; i++) { String beanDefinitionName = beanDefinitionNames[i]; System.out.println("beanDefinitionName = " + beanDefinitionName); } } }
出现错误:dubbo 通配符的匹配很全面, 但无法找到元素 'dubbo:service' 的声明。
10:05:44.125 [main] WARN o.s.b.f.xml.XmlBeanDefinitionReader - Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: 无法读取方案文档 'http://code.alibabatech.com/schema/dubbo/dubbo.xsd', 原因为 1) 无法找到文档; 2) 无法读取文档; 3) 文档的根元素不是 <xsd:schema>。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.warning(ErrorHandlerWrapper.java:99) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:392) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:306) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:4158) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaWarning(XSDHandler.java:4149) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument1(XSDHandler.java:2491) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2193) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:578) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:610) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2447) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1768) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:761) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:79) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:67) at com.example.test_nacos.DetectorL.detectDobboXml(DetectorL.java:43) at com.example.test_nacos.DetectorL.main(DetectorL.java:33) Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at sun.net.NetworkClient.doConnect(NetworkClient.java:180) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.http.HttpClient.<init>(HttpClient.java:242) at sun.net.www.http.HttpClient.New(HttpClient.java:339) at sun.net.www.http.HttpClient.New(HttpClient.java:357) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(XMLEntityManager.java:647) at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java:148) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:583) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaParsingConfig.parse(SchemaParsingConfig.java:686) at com.sun.org.apache.xerces.internal.impl.xs.opti.SchemaDOMParser.parse(SchemaDOMParser.java:530) at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchemaDocument(XSDHandler.java:2181) ... 24 common frames omitted Exception in thread "main" org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 8 in XML document from file [E:deverdp2erdp_discusserdp_discuss_appsrcmain esourcesdubbo.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 51; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。 at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:404) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:79) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:67) at com.example.test_nacos.DetectorL.detectDobboXml(DetectorL.java:43) at com.example.test_nacos.DetectorL.main(DetectorL.java:33) Caused by: org.xml.sax.SAXParseException; lineNumber: 8; columnNumber: 51; cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明。 at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3231) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1912) at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:761) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:243) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:77) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadDocument(XmlBeanDefinitionReader.java:434) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:392) ... 6 more
启动过程中,感觉会去下载,但是下载了好一会却下载不成功。。
其实 Spring提供了一种机制,默认从本地加载XSD文件 。仔细检查,好像命名空间有问题, 是dubbo从2.6.5升级到 2.7.1 引起的吗? code.alibabatech.com 改成 dubbo.apache.org ,还是不行:
Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo]
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://dubbo.apache.org/schema/dubbo] Offending resource: file [E:deverdp2erdp_systemerdp_system_appsrcmain esourcesdubbo.xml] at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:72) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:119) at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:111) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:281) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1363) at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1352) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:179) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:149) at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:96) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:513) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:393) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336) at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:79) at org.springframework.beans.factory.xml.XmlBeanFactory.<init>(XmlBeanFactory.java:67) at com.example.test_nacos.DetectorL.getDobboXml(DetectorL.java:42) at com.example.test_nacos.DetectorL.compareDubboXml(DetectorL.java:25) at com.example.test_nacos.DetectorL.main(DetectorL.java:20)
想起来了之前读spring源码的时候, 对应于每一个xml 的命名空间,spring 都需要一个NamespaceHandler,比如Context需要 ContextNamespaceHandler 。
难道要修改jar 的spring.handlers/spring.schemas 文件? 检查 spring-context-5.1.5.RELEASEMETA-INFspring.handlers ,发现基本正常
http://www.springframework.org/schema/context=org.springframework.context.config.ContextNamespaceHandler
http://www.springframework.org/schema/jee=org.springframework.ejb.config.JeeNamespaceHandler
http://www.springframework.org/schema/lang=org.springframework.scripting.config.LangNamespaceHandler
http://www.springframework.org/schema/task=org.springframework.scheduling.config.TaskNamespaceHandler
http://www.springframework.org/schema/cache=org.springframework.cache.config.CacheNamespaceHandler
突然想到,dubbo-jar 都没有引入呢!
<dependency> <groupId>org.apache.dubbo</groupId> <artifactId>dubbo</artifactId> <version>2.7.1</version> </dependency>
加入就好了!
------------------------------------------------------------------------------------------------------------------------------------------------
总结一下
这样的问题,通常是由于升级引起的,特别是有些jar升级后不兼容之前的版本就会出现。
但Spring很贴心,把旧版本的XSD文件也全放了。这样可以防止升级了Spring版本,而配置文件里用的还是旧版本的XSD文件,然后断网了,应用启动不了。
我解压dubbo jar之后看到spring-context-5.1.5.RELEASEMETA-INFspring.schemas :
可见,基本上都有了。但是xsd 只有一个:
所以,如果用最新的jar ,然后xml配置老的 命名空间,那么还是会去下载xsd。下载
参考
https://dslztx.github.io/blog/2019/02/20/Unable-to-locate-Spring-NamespaceHandler-for-XML-schema-namespace/
https://www.jianshu.com/p/b16a4384dfdb
https://blog.csdn.net/wcf2010/article/details/86229222
https://blog.csdn.net/wxydaisy/article/details/40650405