[英]Error creating Neo4j repository: "The schema already contains a node description under the primary label"
The project contains the following files.该项目包含以下文件。
MyGoogleCalendarNeo4jRepository.java: MyGoogleCalendarNeo4jRepository.java:
import org.springframework.data.repository.CrudRepository;
public interface MyGoogleCalendarNeo4jRepository extends CrudRepository<MyGoogleCalendar, String> {}
MyGoogleCalendar.java: MyGoogleCalendar.java:
import org.springframework.data.neo4j.core.schema.Id;
import org.springframework.data.neo4j.core.schema.Relationship;
public class GoogleCalendarCalendar {
@Relationship(type = "ASSOCIATED_TO", direction = Relationship.Direction.OUTGOING)
private Calendar calendar;
@Id
private String id;
/*
* Default getters and setters
*/
...
}
Calendar.java:日历.java:
import org.springframework.data.neo4j.core.schema.Id;
public class Calendar {
@Id
private String id;
private com.google.api.services.calendar.Calendar service;
/*
* Default getters and setters
*/
...
}
When I try to run the project, I get the following error:当我尝试运行该项目时,出现以下错误:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name [...] nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myGoogleCalendarNeo4jRepository' defined in com.[...].MyGoogleCalendarNeo4jRepository defined in @EnableNeo4jRepositories declared on MyApplication: Invocation of init method failed; org.springframework.beans.factory.UnsatisfiedDependencyException:创建名称为 [...] 的 bean 时出错嵌套异常是 org.springframework.beans.factory.BeanCreationException:在 com 中定义的名称为“myGoogleCalendarNeo4jRepository”的 bean 创建时出错。[...] .MyGoogleCalendarNeo4jRepository 在 MyApplication 上声明的 @EnableNeo4jRepositories 中定义:调用 init 方法失败; nested exception is org.springframework.data.mapping.MappingException: The schema already contains a node description under the primary label Calendar
嵌套异常是 org.springframework.data.mapping.MappingException:架构已经包含主 label 日历下的节点描述
Eg: from Calendar to MyCalendar例如:从日历到MyCalendar
Calendar.java:日历.java:
import org.springframework.data.annotation.Transient;
import org.springframework.data.neo4j.core.schema.Id;
public class Calendar {
@Id
private String id;
@Transient
private com.google.api.services.calendar.Calendar service;
/*
* Default getters and setters
*/
...
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.