有没有人一起配置Spring 4.2.3.RELEASE和Hibernate 5.0.4.Final?来自Spring的官方文档说从版本4.2开始支持Hibernate版本5.但是如果将它们配置在一起我总是得到以下异常
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.aop.framework.autoproxy.AutoProxyUtils.determineTargetClass(Lorg/springframework/beans/factory/config/ConfigurableListableBeanFactory;Ljava/lang/String;)Ljava/lang/Class; at org.springframework.context.event.EventListenerMethodProcessor.afterSingletonsInstantiated(EventListenerMethodProcessor.java:78) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:792) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:838) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext. (ClassPathXmlApplicationContext.java:83) at me.shafin.sustord.dao.App.main(App.java:8)
这是pom.xml
4.0.0 org.springframework.samples.service.service RokomiMoc 0.0.1-SNAPSHOT war 1.8 UTF-8 UTF-8 2.3.1 1.2 3.1.0 4.2.3.RELEASE 3.2.5.RELEASE 5.0.4.Final 5.0.1.Final 1.1.0.Final 1.3.1 1.0.13 1.7.5 4.11 1.8 1.8 org.springframework spring-core ${spring-framework.version} org.springframework spring-webmvc ${spring-framework.version} org.springframework spring-orm ${spring-framework.version} org.springframework spring-aspects ${spring-framework.version} org.springframework spring-expression ${spring-framework.version} org.springframework spring-aop ${spring-framework.version} org.springframework spring-context ${spring-framework.version} javax.servlet jstl ${jstl.version} javax.servlet.jsp javax.servlet.jsp-api ${jsp.version} org.springframework.security spring-security-core ${spring-security.version} org.springframework.security spring-security-config ${spring-security.version} org.springframework.security spring-security-web ${spring-security.version} org.springframework.security spring-security-taglibs ${spring-security.version} javax.validation validation-api ${javax.validation.version} org.hibernate hibernate-validator ${hibernate.validator.version} org.hibernate hibernate-core ${hibernate-framework.version} org.hibernate hibernate-entitymanager ${hibernate-framework.version} mysql mysql-connector-java 5.1.37 c3p0 c3p0 0.9.1.2 javax.transaction jta 1.1 jaxen jaxen 1.1.6 commons-fileupload commons-fileupload ${commons-fileupload.version} org.codehaus.jackson jackson-mapper-asl 1.9.13 javax.servlet javax.servlet-api ${servlet.version} org.slf4j slf4j-api ${slf4j.version} compile org.springframework spring-test ${spring-framework.version} test junit junit ${junit.version} test org.eclipse.persistence org.eclipse.persistence.jpa.modelgen.processor 2.5.2 provided javax.annotation jsr250-api 1.0 provided org.springframework spring-beans 4.2.3.RELEASE com.sun.mail javax.mail 1.5.4 javax.mail 1.4.7 org.springframework spring-context-support 4.2.3.RELEASE
使用Spring 4.0.6和Hibernate 4.3.6,这个pom.xml和我的其他配置都很好......任何人都可以分享他/她对这些最新版本兼容性问题的经验.或者是否有任何新的方法将它们配置在一起我不知道了?
我在几个小时内处理同样的问题.我注意到 :
[INFO] +- org.springframework.security:spring-security-core:jar:4.0.3.RELEASE:compile [INFO] | +- aopalliance:aopalliance:jar:1.0:compile [INFO] | \- org.springframework:spring-aop:jar:4.2.2.RELEASE:compile
这表明最新的spring-security-core版本4.0.3.RELEASE依赖于Spring Framework 4.2.2.RELEASE.
你有两个解决方案:
1)为spring-security-core排除spring-aop 4.2.2并明确地将spring-aop:jar:4.2.3.RELEASE的依赖描述添加到你的pom文件中.
2)将4.2.3.RELEASE依赖项更改为4.2.2.RELEASE并将Hibernate版本5.0.4.Final更改为5.0.2.Final
我选择第二种方式,它对我有用.