1

这是我的 pom.xml 中的依赖项,

    <dependency>
        <groupId>io.spring.platform</groupId>
        <artifactId>platform-bom</artifactId>
        <!--<version>1.1.4.RELEASE</version> -->
        <version>2.0.7.RELEASE</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>
    <dependency>
        <!-- Import dependency management from Spring Boot -->
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-dependencies</artifactId>
        <version>1.4.0.RELEASE</version>
        <!--<version>1.2.7.RELEASE</version> -->
        <type>pom</type>
        <scope>import</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-releasetrain</artifactId>
        <version>Hopper-SR2</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-neo4j</artifactId>
        <version>4.1.0.RC1</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>

和许多其他依赖项

我的应用程序使用内存中的 derby(嵌入式配置文件)/MySQL(远程配置文件)进行事务数据存储,使用 Neo4j 图形数据库处理分层数据存储。我的要求是基于 maven 配置文件在远程和嵌入式模式下运行 Neo4j。默认情况下,spring 版本管理器使用旧版本的 Spring-data-neo4j (3.xx),但嵌入式 Neo4j 支持仅在 4.0.0 版之后可用。当我使用上面显示的配置构建我的应用程序时,我收到如下所示的错误,

// ...exception stacktrace

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'locationRepository': Invocation of init method failed; nested exception is java.lang.AbstractMethodError
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1192)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1116)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1014)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:545)
    ... 57 common frames omitted
Caused by: java.lang.AbstractMethodError: null
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:416)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:206)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.initAndReturn(RepositoryFactoryBeanSupport.java:251)
    at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:237)
    at org.springframework.data.neo4j.repository.support.GraphRepositoryFactoryBean.afterPropertiesSet(GraphRepositoryFactoryBean.java:43)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
    ... 67 common frames omitted

我猜这个错误是因为 Spring-data-commons 的版本冲突。有没有办法解决这个错误?

4

1 回答 1

0

Hopper-SR2支持 Spring-data-neo4j 4.1.2。为什么要降级到 4.1.0.RC1?尝试删除以降级或明确将其设置为 4.1.2。

如果您仍然认为您正在获得 3.x 版本,请运行以下命令并查找 3.x 版本中的内容。

mvn dependency:tree -Dverbose -Dincludes=spring-data-neo4j

您可以使用相同的过程来查找与 spring-data-commons 的冲突。只需更改包含参数(或为所有依赖项省略它)。如果发现冲突,请在 pom.xml 中明确包含正确的版本。

于 2016-08-01T15:54:03.870 回答