Maven pom.xml
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
</dependency>
实体类
@Node
public class Person {
@Id
@GeneratedValue
private Long id;
@Property("cid")
private int pid;
@Property
private String name;
private double money;
@Relationship(type = "Friends", direction = Relationship.Direction.INCOMING)
private Set<Person> relationPersons;
}
DAO层
public interface PersonRepository extends Neo4jRepository<Person,Long> {
@Query("match(p:Person) where p.money > {0} return p")
List<Person> personList(double money);
}
application.yml
spring:
neo4j:
authentication:
password: 123123
username: neo4j
uri: bolt://10.10.52.38:7687