spring-boot-starter-data-neo4j因Neo4jDataAutoConfiguration错误

时间:2018-12-20 22:15:25

标签: spring-boot gradle neo4j spring-data-neo4j

我有一个正在工作的IntelliJ项目,该项目使用spring-boot-gradle-plugin:2.0.5.RELEASE。当我添加单行

compile("org.springframework.boot:spring-boot-starter-data-neo4j")

build.gradle,项目中断

  

创建名称为'neo4jAuditionBeanFactoryPostProcessor'的bean时出错:   通过构造函数参数0表示的不满意依赖性;

对于如何将neo4j成功添加到我的项目中的任何建议,我将不胜感激。

我尝试添加

compile("org.springframework.boot:spring-boot-devtools")
runtime("org.neo4j:neo4j:3.4.9")
testCompile("org.neo4j:neo4j-ogm-embedded-driver")
compile("org.neo4j:neo4j-ogm-bolt-driver")

没有成功。

我正在使用IntelliJ IDEA Ultimate 2018.3。
我能够在https://spring.io/guides/gs/accessing-data-neo4j/
上成功构建并运行“使用Neo4j访问数据”的Spring入门指南。 其build.gradle文件中唯一的依赖项是

dependencies {
    compile("org.springframework.boot:spring-boot-starter-data-neo4j")
}

既然构建成功,为什么在我将其添加到项目中时不添加该单个依赖项呢?

完整的警告消息是:

  

2018-12-20 13:51:31.323 WARN 13440 --- [main]
  ConfigServletWebServerApplicationContext:
  上下文初始化期间遇到异常-取消刷新尝试:
  org.springframework.beans.factory.UnsatisfiedDependencyException:
  创建名称为'neo4jAuditionBeanFactoryPostProcessor'的bean时出错:
  通过构造函数参数0表示的不满意依赖性;
  嵌套异常是
  org.springframework.beans.factory.BeanCreationException:   创建在类路径资源[org / springframework / boot / autoconfigure / data / neo4jNeo4jDataAutoConfiguration.class]中定义的名称为'sessionFactory'的bean时出错:
  通过工厂方法实例化Bean失败;
  嵌套异常是
  org.springframework.beans.BeanInstantiationException:
  无法实例化[org.neo4j.ogm.session.SessionFactory]:
  工厂方法“ sessionFactory”抛出异常;
  嵌套异常是
  java.lang.NullPointerException

这是我的build.gradle文件:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.5.RELEASE")
        classpath('com.google.code.gson:gson:2.8.2')
    }
}

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

jar {
    baseName = 'automentor'
    version = '0.1.0'
}

repositories {
    maven {
        url "https://plugins.gradle.org/m2/"
    }
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8

configurations {
    providedRuntime
}

dependencies {
    compile "org.springframework.boot:spring-boot-starter-data-rest"
    compile "org.springframework.boot:spring-boot-starter-data-jpa"

    compile "org.springframework.boot:spring-boot-starter-data-neo4j"

    compile "org.springframework.boot:spring-boot-starter-web"
    compile "org.springframework.boot:spring-boot-starter-security"
    compile 'org.springframework.data:spring-data-rest-hal-browser'
    compile 'javax.json:javax.json-api:1.1'
    compile 'org.apache.commons:commons-lang3:3.0'
    compile group: 'org.apache.httpcomponents', name: 'fluent-hc', version: '4.5.6'
    compile group: 'org.json', name: 'json', version: '20160810'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
    compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.3'
    compile "org.glassfish:javax.json:1.1"
    compile "org.flywaydb:flyway-core:4.2.0"
    compile 'org.springframework.data:spring-data-rest-hal-browser'
    testCompile("org.springframework.boot:spring-boot-starter-test")
    providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    runtime("mysql:mysql-connector-java:6.0.3")
    compile 'javax.xml.bind:jaxb-api:2.3.0'

    runtime("org.springframework.boot:spring-boot-properties-migrator")
}

bootRun {
    systemProperties = System.properties
    systemProperties.remove("java.endorsed.dirs")
    sourceResources sourceSets.main
    environment SPRING_PROFILES_ACTIVE: environment.SPRING_PROFILES_ACTIVE ?: "local"
}

0 个答案:

没有答案