首页 > 编程语言 > 详细

nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a

时间:2018-01-31 23:12:52      阅读:580      评论:0      收藏:0      [点我收藏+]

公司还用的是spring低版本,今天用jre 8测试了一下,发现错误:

Unexpected exception parsing XML document from class path resource [applicationContext-dao.xml]; nested exception is java.lang.IllegalStateException: Context namespace element ‘annotation-config‘ and its parser class [org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser] are only available on JDK 1.5 and higher,看源码是org.springframework.context.annotation.AnnotationConfigBeanDefinitionParser自动检测,jdk版本检测时需要jre1.5以上版本,但是JdkVersion只检查到了1.7,jre1.8 时不匹配任何jdk。

网上招到了解决的方法,https://my.oschina.net/u/553266/blog/825103

 

网上的解决方法无非两种:降低jdk的版本或者修改spring-2.5.6.jar的源码.这些都不是我想要的。我查看了一下在spring-2.5.6jar的org\springframework\core\下有JdkVersion.class这个类,同时在spring-core.4.2.0.RELEASE也有这个类,所以在引入jar包的时候不需要引入spring-2.5.6jar只引入spring-core.4.2.0.RELEASE就行了。问题解决。

nested exception is java.lang.IllegalStateException: Context namespace element 'annotation-config' a

原文:https://www.cnblogs.com/java-synchronized/p/8394952.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!