Spring Boot项目使用spring-data-neo4j连接neo4j,一直在本地跑可以正常启动、访问数据库;写好dockerfile,使用docker compose在服务器上跑会报错,如:
Caused by: java.lang.NullPointerException: null
at org.neo4j.ogm.MetaData.entityType(MetaData.java:280)
原因:
https://github.com/spring-projects/spring-boot/issues/6709
在pom.xml里加入依赖,问题解决:
<!--不加这个包放到docker中跑会报错-->
<!--https://github.com/spring-guides/gs-accessing-data-neo4j/issues/19-->
<dependency>
<groupId>io.github.lukehutch