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
大意: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 啦!