【发布时间】:2015-08-05 16:24:20
【问题描述】:
我正在升级我们的应用程序,它以sdn-university 为模型,从 Spring Data Neo4j 3.x 升级到 Spring Data Neo4j 4.0.0.BUILD-SNAPSHOT。添加自动装配的 Neo4jTemplate 实例时,启动时会引发以下异常:
... 原因: org.springframework.beans.factory.BeanCreationException:不能 自动装配字段:私有 org.springframework.data.neo4j.template.Neo4jTemplate school.service.UserServiceImpl.template;嵌套异常是 org.springframework.beans.factory.NoSuchBeanDefinitionException: 否 符合条件的 bean 类型 [org.springframework.data.neo4j.template.Neo4jTemplate] 找到 依赖项:预计至少有 1 个符合自动装配条件的 bean 这种依赖的候选人。依赖注解: {@org.springframework.beans.factory.annotation.Autowired(required=true)} 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:571) 在 org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88) 在 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331) ... 21 更多 ...
为了验证结果,我采用了最新的 sdn-university——它现在也使用了来自 https://github.com/neo4j-examples/sdn4-university 的 SDN4.x 4.0.0.BUILD-SNAPSHOT——并修改了 StudentServiceImpl 以包含一个自动装配'd Neo4jTemplate 的实例。发出mvn clean spring-boot:run -U 后,我们的应用程序中看到的错误就会重现。
需要将什么更改为 sdn-university 才能成功使用 Neo4jTemplate?
【问题讨论】:
标签: java spring spring-data-neo4j spring-data-neo4j-4