此次的项目是由上一个项目[使用 IDEA 中创建 SpringBoot + Neo4J 的 WEB 项目]模仿并进行改进而来。
这里只显示较为重要的代码部分,若需要整体项目,请到文章底部获取Github地址。
1.项目目录结构,如下图所示:
2.DataConfig:
1 | import org.neo4j.ogm.config.ClasspathConfigurationSource; |
3.Book:
1 | import lombok.Getter; |
4.Role:
1 | import lombok.*; |
5.Student:
1 | import lombok.*; |
6.RoleRepo:
1 | import com.chanchifeng.data.domain.Role; |
7.BookServiceImpl:
1 | import com.chanchifeng.data.common.vo.PageVO; |
8.ogm.properties:
1 | URI=http://localhost:7474 |
9.WebApplication:
1 | import org.springframework.boot.SpringApplication; |
10.resources/templates/ndeo4j/student/index.html:
1 |
|
11.application.yml:
1 | server: |
12.data/pom.xml:
1 |
|
13.web/pom.xml:
1 |
|
14.项目根路径/pom.xml:
1 |
|
15.在浏览器中输入http://localhost:8080/neo4j/,即可测试项目的功能,如下图所示: