Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/neo4j/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Scala spring-data-neo4j-创建名为';neo4jTemplate&x27;_Scala_Neo4j_Spring Data Neo4j - Fatal编程技术网

Scala spring-data-neo4j-创建名为';neo4jTemplate&x27;

Scala spring-data-neo4j-创建名为';neo4jTemplate&x27;,scala,neo4j,spring-data-neo4j,Scala,Neo4j,Spring Data Neo4j,我试图将neo4j与spring数据和scala一起使用,但我遇到了以下异常: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jTemplate': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:scala.collect

我试图将neo4j与spring数据和scala一起使用,但我遇到了以下异常:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jTemplate': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError:scala.collection.JavaConverters$.mapAsScalaMapConverter(Ljava/util/Map;)Lscala/collection/JavaConverters$AsScala;
现在,我不确定如何“注入”JavaConverter

有什么想法吗

更新:

我尝试将导入简单地放在测试类中:

导入scala.collection.JavaConverters_

但不起作用,以下是完整的代码:

斯卡拉语

package com.dimeder.llull.security

import org.junit.runner.RunWith
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.context.ContextConfiguration
import org.junit.Test
import org.slf4j.LoggerFactory
import org.springframework.transaction.annotation.Transactional
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.data.neo4j.support.Neo4jTemplate
import com.dimeder.llull.models.Word
import scala.collection.JavaConverters._

@RunWith(classOf[SpringJUnit4ClassRunner])
@ContextConfiguration(Array("classpath:applicationContext-test.xml"))
class WordsTest {
         val logger = LoggerFactory.getLogger(classOf[WordsTest])

  @Autowired
  var template:Neo4jTemplate = _

  @Test
  @Transactional
  def speak(){
      val word:Word = new Word
    word.text="sustancia"
    template.save(word)
    val backWord:Word = template.findOne(word.id,classOf[Word])
    logger.info(word.text.equalsIgnoreCase(backWord.text).toString)
  }
}
applicationContext-test.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:oxm="http://www.springframework.org/schema/oxm"
       xmlns:jaxws="http://cxf.apache.org/jaxws"
       xmlns:http-conf="http://cxf.apache.org/transports/http/configuration"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:task="http://www.springframework.org/schema/task"
       xmlns:neo4j="http://www.springframework.org/schema/data/neo4j"


       xsi:schemaLocation="http://www.springframework.org/schema/mvc
         http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
         http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context-3.0.xsd
         http://www.springframework.org/schema/util
         http://www.springframework.org/schema/util/spring-util-3.0.xsd
         http://www.springframework.org/schema/aop
         http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
         http://www.springframework.org/schema/task
         http://www.springframework.org/schema/task/spring-task-3.0.xsd
         http://www.springframework.org/schema/data/neo4j
         http://www.springframework.org/schema/data/neo4j/spring-neo4j-2.0.xsd
        ">

    <context:spring-configured/>
    <context:annotation-config/>

    <mvc:annotation-driven/>
    <context:component-scan base-package="java.llull."/>

    <neo4j:config storeDirectory="data/graph.db"/>
    <neo4j:repositories base-package="java.llull.repositories"/>

</beans>

更新:

我解决了


问题是scala版本,我使用的是2.10,但它必须是2.9.2

scala for neo4j将在下一个里程碑版本中更新为2.10。谢谢!这是个好消息!