最近在学习马士兵的spring教程,视频教程中的项目中用的是spring低版本(2.5.6),今天用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

在使用Spring 2.5.6版本并尝试在JRE 8环境下运行时,遇到了'annotation-config'解析错误。错误表明该功能仅支持JDK 1.5及以上版本。通过在项目中创建org.springframework.core包,并仿照源码创建JdkVersion.java,然后替换spring-core-2.5.6.jar中的对应类文件,可以解决此问题。完成这些步骤后,重新部署项目即可消除错误。
最低0.47元/天 解锁文章
612

被折叠的 条评论
为什么被折叠?



