在grails中使用spring-data-neo4j得到UnsatisfiedDependencyException

时间:2014-07-22 12:29:46

标签: grails neo4j spring-data-neo4j

我想在我的grails应用程序中使用spring-data-neo4j。

我在BuildConfig中添加了compile 'org.springframework.data:spring-data-neo4j:3.1.1.RELEASE'依赖项。

<neo4j:config storeDirectory="data/graph.db" />添加到applicationContext.xml后 我在申请开始时得到以下异常:

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Unsatisfied dependency expressed through bean property 'conversionService': : Error creating bean with name 'neo4jConversionService' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.springframework.core.convert.ConversionService org.springframework.data.neo4j.config.Neo4jConfiguration.neo4jConversionService() throws java.lang.Exception] threw exception; nested exception is java.lang.IllegalStateException: BeanFactory has not been injected into @Configuration class; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jConversionService' defined in class org.springframework.data.neo4j.config.Neo4jConfiguration: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [protected org.springframework.core.convert.ConversionService org.springframework.data.neo4j.config.Neo4jConfiguration.neo4jConversionService() throws java.lang.Exception] threw exception; nested exception is java.lang.IllegalStateException: BeanFactory has not been injected into @Configuration class

我使用grails 2.4.2

问题是什么?

1 个答案:

答案 0 :(得分:3)

解决方案是将<context:annotation-config/>添加到a​​pplicationContext.xml