出現以下警告:java
2019-07-11 19:47:46.600 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.errorEnabled 2019-07-11 19:47:46.602 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.name 2019-07-11 19:47:46.602 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.infoEnabled 2019-07-11 19:47:46.603 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.debugEnabled 2019-07-11 19:47:46.603 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.traceEnabled 2019-07-11 19:47:46.603 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.warnEnabled 2019-07-11 19:47:46.735 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.errorEnabled 2019-07-11 19:47:46.735 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.name 2019-07-11 19:47:46.736 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.infoEnabled 2019-07-11 19:47:46.736 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.debugEnabled 2019-07-11 19:47:46.736 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.traceEnabled 2019-07-11 19:47:46.737 [main] -| WARN o.s.d.n.mapping.Neo4jPersistentProperty-Owning ClassInfo is null for property: org.slf4j.Logger.warnEnabled
是由於 spring bean 中 定義的 logger 沒有使用 static 修飾
第二,那是可能你包掃描的不正確。參考官方配置
spring
@Configuration @EnableNeo4jRepositories(basePackages = "org.neo4j.example.repository") @EnableTransactionManagement public class MyConfiguration { @Bean public SessionFactory sessionFactory() { // with domain entity base package(s) return new SessionFactory(configuration(), "org.neo4j.example.domain"); } @Bean public org.neo4j.ogm.config.Configuration configuration() { ConfigurationSource properties = new ClasspathConfigurationSource("ogm.properties"); org.neo4j.ogm.config.Configuration configuration = new org.neo4j.ogm.config.Configuration.Builder(properties).build(); return configuration; } @Bean public Neo4jTransactionManager transactionManager() { return new Neo4jTransactionManager(sessionFactory()); } }
2019-07-11 19:49:14.047 [main] -| WARN o.s.b.a.d.n.Neo4jDataAutoConfiguration$Neo4jWebConfiguration$Neo4jWebMvcConfiguration-spring.data.neo4j.open-in-view is enabled by default.Therefore, database queries may be performed during view rendering. Explicitly configure spring.data.neo4j.open-in-view to disable this warning
將 open-in-view: true 配置顯示定義就行session