文章目录
SpringBoot集成neo4j
配置
- xml配置:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-neo4j</artifactId>
<version>2.1.9.RELEASE</version>
</dependency>
- SpringBoot配置:
@SpringBootApplication
@EnableNeo4jRepositories
public class TestApplication {
public static void main(String[] args) {
SpringApplication.run(TestApplication.class, args);
}
}
到这里SpringBoot配置完成,接下来是增删改查
- 实体类
- 节点类
@Data
@NoArgsConstructor
@NodeEntity
public class Bill {
@Id @GeneratedValue
private Long id;
@Property
private Integer billNo;
@Property
private String name;
@Property
private BigDecimal quantity;
}
- 关系类
@RelationshipEntity(type = "MERGE")
@Data
@NoArgsConstructor