美文网首页我爱编程
XML注释中不允许出现字符串"--"

XML注释中不允许出现字符串"--"

作者: CrazyLabs | 来源:发表于2016-05-22 20:22 被阅读0次

五月 22, 2016 8:16:55 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

信息: Loading XML bean definitions from class path resource [spring/spring-dao.xml]

五月 22, 2016 8:16:55 下午 org.springframework.test.context.TestContextManager prepareTestInstance

严重: Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@17596ee0] to prepare test instance [org.seckill.dao.SeckillDaoTest@2bfacee6]

java.lang.IllegalStateException: Failed to load ApplicationContext

at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:124)

at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)

at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)

at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:217)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:276)

at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:278)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:236)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:87)

at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)

at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)

at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)

at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)

at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)

at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)

at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)

at org.junit.runners.ParentRunner.run(ParentRunner.java:363)

at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)

at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)

at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)

at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 56 in XML document from class path resource [spring/spring-dao.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 56; columnNumber: 13; 注释中不允许出现字符串 "--"。

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:399)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:336)

at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:304)

解决方案如下:注释的两边增加空格。

举例——

1.<!--注释-->           错误。注释两边缺少空格

2.<!--  注释  -->       正确。注释两边要有空格

相关文章

  • XML注释中不允许出现字符串"--"

    五月 22, 2016 8:16:55 下午 org.springframework.beans.factory....

  • XML中必须进行转义的字符

    XML实体中不允许出现"&","<",">"等特殊字符,否则XML语法检查时将出错,如果编写的XML文件必须包含这...

  • JS数据操作方式

    indexOf indexOf() 方法可返回某个指定的字符串值在字符串中首次出现的位置。提示和注释注释:inde...

  • Android开发规范

    一、Android编码规范 1.java代码中不出现中文,最多注释中可以出现中文(中文尽量放在String.xml...

  • XML入门-2

    一,XML语义约束 1,XML文档结构正确,但可能不是有效的 比如:员工档案xml中决不允许出现“植物品种”标签。...

  • mybatis中符号转译

    java mybatis XML文件中不允许出现">"、"<"之类的符号。需要转义 "="是可以正常使用的

  • XML注释

    https://docs.microsoft.com/en-us/dotnet/csharp/language-r...

  • 在json中使用注释

    python模块之json注释 JSON为什么不能加注释? 添加注释//或者/**/在JSON文件中是不允许的 J...

  • 解决Comments are not permitted in

    vs code中如何解决JSON中不允许注释? Comments are not permitted? 错误显示:...

  • Android 关于setting的string.xml中pro

    Android的资源文件string.xml会出现下面同名的字符串,如下所示 Xml代码 "智能电视" "智...

网友评论

    本文标题:XML注释中不允许出现字符串"--"

    本文链接:https://www.haomeiwen.com/subject/krwvxttx.html