当前位置: 首页 > 知识库问答 >
问题:

带嵌入式neo 2的Spring数据neo4j 3

晋骏喆
2023-03-14

我在我的脚手架上工作,我似乎无法让尼奥嵌入初始化。我使用Neo 2,所以我运行Spring数据3.0.0. m1。我不能让它亮起来。这是我的背景

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"
       xmlns:tx="http://www.springframework.org/schema/tx"

       xsi:schemaLocation="http://www.springframework.org/schema/beans
          http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/aop
          http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
          http://www.springframework.org/schema/context
          http://www.springframework.org/schema/context/spring-context-2.5.xsd
          http://www.springframework.org/schema/tx
          http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">

    <context:annotation-config/>
    <context:spring-configured />
    <context:component-scan base-package="com.onuspride.wisdom" />

    <tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>

    <import resource="spring-data-Neo4j.xml" />

    <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
        <property name="transactionManager">
            <bean id="jotm" class="org.springframework.data.neo4j.transaction.JotmFactoryBean"/>
        </property>
    </bean>

    <bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
        <constructor-arg value="target/test-db"/>
        <constructor-arg>
            <map>
                <entry key="tx_manager_impl" value="spring-jta"/>
            </map>
        </constructor-arg>
    </bean>

</beans>

但我有个例外

Exception in thread "main" org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'graphDatabaseService' defined in class path resource [applicationContext.xml]: Unsatisfied dependency expressed through constructor argument with index 2 of type [java.lang.Iterable]: Ambiguous constructor argument types - did you specify the correct bean references as constructor arguments?
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:724)
    at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1075)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:979)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:487)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)

我找不到任何地方说有更多的构造函数参数。

这是我的依赖项

akka = '2.2.3'
        akkaSeries = '_2.10'
        apacheLog4jVersion = '2.0-beta9'
        aspectjVersion = '1.7.2'
        cglibVersion = '2.2.2'
        commonsCodecVersion = '1.5'
        commonsDigesterVersion = '2.1'
        commonsFileuploadVersion = '1.3'
        commonsLang3Version = '3.1'
        elApiVersion = '1.0'
        fasterxmlJacksonVersion = '2.3.0'
        flexJsonVersion = '2.1'
        ginVersion = '2.0.0'
        googleAPIClient = '1.17.0-rc'
        googleAPIDrive = 'v2-rev110-1.17.0-rc'
        googleAPIOauth2 = 'v2-rev59-1.17.0-rc'
        googleJackson = '1.15.0-rc'
        guavaVersion = '14.0.1'
        guiceVersion = '3.0'
        gwtpVersion = '1.0.3'
        gwtqueryVersion = '1.3.2'
        gwtsecurityVersion = '1.2.3'
        gwtVersion = '2.5.1'
        hamcrestDateVersion = '0.9.5'
        hibernateValidator = '5.0.2.Final'
        ioSpray = '1.2.0'
        javaxServletVersion = '3.0.1'
        jedisVersion = '2.1.0'
        jettyVersion = '9.1.0.v20131115'
        jodaTimeVersion = '1.6'
        json4sVersion = '3.2.6'
        jspApiVersion = '2.1'
        jstlApiVersion = '1.2'
        jukitoVersion = '1.1'
        junitVersion = '4.11'
        lmaxDistruptorVersion = '3.2.0'
        neo4jVersion = '2.0.0'
        persistenceApiVersion = '1.0'
        scalaLangVersion = '2.10.2'
        slf4jVersion = '1.7.5'
        socialSigninTwitterVersion = '1.1.0-SNAPSHOT'
        //springDataNeo4jVersion = '2.3.3.RELEASE'
        springDataNeo4jVersion = '3.0.0.M1'
        springDataRedis = '1.1.0.RELEASE'
        springJsResourcesVerison = '2.3.2.RELEASE'
        springJsVersion = '2.3.2.RELEASE'
        springScalaVersion = '1.0.0.RC1'
        springSecurityVersion = '3.2.0.RELEASE'
        springSocialGoogleVersion = '1.0.0.M3'
        springSocialVersion = '1.1.0.M4'
        springVersion = '3.2.6.RELEASE'
        tilesJspVersion = '2.2.2'

compile "com.lmax:disruptor:$lmaxDistruptorVersion"
        compile "com.typesafe.akka:akka-actor$akkaSeries:$akka"
        compile "com.typesafe.akka:akka-slf4j$akkaSeries:$akka"
        compile "io.spray:spray-can:$ioSpray"
        compile "io.spray:spray-routing:$ioSpray"
        compile "joda-time:joda-time:$jodaTimeVersion"
        compile "org.apache.logging.log4j:log4j-api:$apacheLog4jVersion"
        compile "org.apache.logging.log4j:log4j-core:$apacheLog4jVersion"
        compile "org.apache.logging.log4j:log4j-slf4j-impl:$apacheLog4jVersion"
        compile "org.hibernate:hibernate-validator:$hibernateValidator"
        compile "org.json4s:json4s-native_2.10:$json4sVersion"
        compile "org.scala-lang:scala-library:$scalaLangVersion"
        compile "org.springframework.data:spring-data-neo4j-aspects:$springDataNeo4jVersion"
        compile "org.springframework.data:spring-data-neo4j-tx:$springDataNeo4jVersion"
        compile "org.springframework.data:spring-data-neo4j:$springDataNeo4jVersion"
        compile "org.springframework.scala:spring-scala_2.10:$springScalaVersion"
        compile "org.springframework:spring-aop:$springVersion"
        compile "org.springframework:spring-aspects:$springVersion"
        compile "org.springframework:spring-context:$springVersion"
        compile "org.springframework:spring-core:$springVersion"
        compile "org.springframework:spring-tx:$springVersion"
        compile group: 'org.neo4j', name: 'neo4j', version: "$neo4jVersion"
        compile group: 'org.neo4j.app', name: 'neo4j-server', version: "$neo4jVersion", classifier: 'static-web'
        testCompile "junit:junit:$junitVersion"
        testCompile "org.mockito:mockito-all:1.9.5"
        testCompile "org.springframework:spring-test:$springVersion"

共有2个答案

贺恩
2023-03-14

我也有同样的问题。更改Spring数据。将xml转换为以下内容有助于解决此问题。。。

<tx:annotation-driven mode="aspectj" transaction-manager="transactionManager"/>
<bean class="org.springframework.data.neo4j.config.Neo4jConfiguration"/>
<bean class="org.springframework.context.annotation.ConfigurationClassPostProcessor"/>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase"
      destroy-method="shutdown" scope="singleton">
</bean>
<bean id="serverWrapper" class="org.neo4j.server.WrappingNeoServerBootstrapper" init-method="start" destroy-method="stop">
<constructor-arg index="0" ref="graphDatabaseService"/>
</bean>    
<neo4j:config storeDirectory="target/db/data"/>
<neo4j:repositories base-package="org.example.repository"/>     
罗建弼
2023-03-14

Spring数据Neo4j 3.0。M1仅适用于Neo4j 2.0。0-M06

下一个里程碑已经准备就绪,将与Neo4j 2.0一起使用。0

 类似资料:
  • 在Spring,嵌入式ldap如何与sping-ldap模板一起使用。目前,我的配置是- ContextSource值在属性文件中可用。现在我想使用嵌入式ldap- 我将在LdapContextSource值中指定的默认端口是什么。

  • 我有一个Spring Boot和嵌入式Mongo DB的项目,我也想查找存储在那里的数据。我学习了本教程https://springframework.guru/spring-boot-with-embedd-mongoDB/

  • 问题内容: 对于单元测试(如果需要,可将其称为集成测试),我已经在Spring配置中配置了嵌入式数据库,如下所示: 现在,从命令行运行测试时,它们可以正常工作,但是最后我得到一些错误(无害,但很烦人): 现在,包含在异常中的提示通常很好,但是如何将此属性添加到嵌入式数据源?我是否必须扩展它,手动配置它以添加此类 “高级” 功能? 问题答案: 在JDBC网址jdbc:h2:〜/ test中 指定参数

  • 我终于能够在我的java应用程序中创建一个服务器实例,使用嵌入式数据库,如下所述。当我在Eclipse上运行它时,它可以正常工作,但这实际上不是我的目的(我的应用程序在其他事情之间,为数据库提供新的节点和关系)。我有一个Neo4j盒子,它应该是我的服务器实例,我想把我的应用程序作为JAR文件部署在那里。这样,我想从那里访问web界面。我已经对它进行了测试:在我的开发机器上运行java应用程序时,同

  • 我试图让Spring Boot中的嵌入式Tomcat记录到我的Log4J2配置中,但它不起作用。 根据这个与外部Tomcat打交道的答案:https://stackoverflow.com/a/28639068/1845463似乎有必要将一些罐子移到$Catalina_home/libs等。我认为这在Spring Boot中是不可能的,不是吗? 有人设法让log4j2运行,并能够为catalina