欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher

程序员文章站 2022-06-26 19:06:38
報錯: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.xml]; ne ......

報錯:

org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [beans.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

AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher

大意:SPRING的注解配置解析器只能在JDK1.5或更高版本使用,我的ECLIPSE 默认的是1.8,我使用的SPRING版本是2.5,总之就是1.8的JDK太高了,SPRING 支持不了。

前提是:你在Spring容器里面配置了,annotation-driven来启用事务

<!-- 配置事务管理器,统一管理session Factory的事务 -->
    <bean id="txManager"
        class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <!-- 启用事务注解 -->
    <tx:annotation-driven
        transaction-manager="txManager" />

解决:项目右键--》BUILD PATH--》Config Build Path--》Libraries-->Jre System Library--》Edit--》配置1.7的就OK 啦!

AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher