We recently working on migrating a project from using neo4j bolt driver to neo4j SDN/RX driver. Testing was done on spring boot 2.4.0 and spring-data-neo4j 6.0.1. The following error was noticed :
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'shelfService' defined in URL [jar:file:/Users/rbaiad/IdeaProjects/smartcapacity-import/target/smartcapacity-import-0.0.1-RELEASE.jar!/BOOT-INF/classes!/com/ciena/scimport/service/ShelfService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tapiTopologyNodeRepository' defined in com.ciena.tapimongo.repository.TapiTopologyNodeRepository defined in @EnableNeo4jRepositories declared on ScUpdaterApplication: Cannot resolve reference to bean 'neo4jTemplate' while setting bean property 'neo4jOperations'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'neo4jTemplate' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]: Unsatisfied dependency expressed through method 'neo4jTemplate' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'neo4jMappingContext' defined in class path resource [org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.mapping.MappingException: Missing @TargetNode declaration in class com.ciena.smartcapacity.domain.Connects
Although looking into Connects class we see that the @TargetNode is indeed declared :
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(exclude = {"route", "ne"}, callSuper = false)
@ToString(exclude = {"route", "ne"})
@RelationshipProperties
public class Connects {
@Id
@GeneratedValue
private Long graphId;
@Property(name = "Route_ID")
private String id;
@Property("Capture_Id")
private Long captureId;
@Property(name = "Date_NetworkExtract")
@DateLong
private Date networkExtract;
private RouteEntity route;
@TargetNode
private NetworkElement ne;
}
And the following snippets shows the relationship :
@Relationship(type = "CONNECTS", direction = Relationship.Direction.INCOMING)
private List<Connects> incomingConnections = new ArrayList<>();