This PR adapts Spring Boot 2.4 to Spring Data Neo4j 6.
For some background: Neo4j has developed two projects in the last year
- A starter dedicated for the Java Driver for Neo4j (dubbed the "Bolt Driver") https://github.com/neo4j/neo4j-java-driver-spring-boot-starter
- SDN/RX: https://github.com/neo4j/sdn-rx Which does imperative and reactive Spring Data Neo4j purely based on the Bolt Driver
SDN/RX has become SDN 6 and is now merged into Spring Data Neo4j.
That means Spring Boot depending on the Ockham release train will not build anymore.
This adapts Spring Boot 2.4 to the SDN 6
- It brings automatic configuration for the Bolt Driver under the new namespace
spring.neo4j
, similar to others (like mongo and redis) - Adapts automatic configuration for Spring Data Neo4j
This removes the dependency on Neo4j-OGM as well.
SDN 6 won't have support for bringing up an embedded instance, which is in line with our strategy to recommend Testcontainers or the Neo4j Testharness to our customers and users.
We refrained from adding support for the Neo4j Testharness to the test slices to not broaden the topic more. However, if we want to help users to bring something up running very fast, that would be an additional option.
The change https://github.com/spring-projects/spring-boot/compare/master...meistermeier:feature/neo4j-starter?expand=1#diff-76ff4fe38f0762e0fcb54986cae8e0b6R1608 is in there to enable SDN 6 for now because the dependency to Spring Data is on Ockham M1 where SDN 6 is not available.
We are looking forward to your feedback.
Comment From: wilkinsona
Thanks for the PR, @meistermeier.
This looks great but there is quite a lot to take in here. To make it easier to review, I wonder if it would be possible to split it out into separate commits or, ideally, separate pull requests please? For example, the addition of metrics looks great but I think it warrants a separate pull request.
In addition to making things easier for us to review, splitting things up will also make the changes easier to understand if we're reviewing a diff in the future. Perhaps most importantly, separate pull requests will result in a separate entries in the release notes which will hopefully make it easier for users to discover the new features.
Comment From: meistermeier
Thanks for your quick response, Andy. When I saw the changes in the PR, I also thought "wow" and you are right this should get splitted in sensible parts (commits or PRs). Can wel keep this PR open for the SDN spring-boot starter update? I will go ahead and try to extract driver autoconfig and metrics into different PRs.
Comment From: wilkinsona
Can wel keep this PR open for the SDN spring-boot starter update? I will go ahead and try to extract driver autoconfig and metrics into different PRs.
Thanks. That sounds good to me. This PR modified so that it's just for compatibility with the latest Spring Data Ockham snapshots, and then others on top of that to introduce new features.
Comment From: meistermeier
So I splitted this up into several PRs but unfortunately they cannot get merged independently :( Bringing this into an order: Neo4j Java Driver autoconfig: https://github.com/spring-projects/spring-boot/pull/22301 Spring Data Neo4j starter (this): https://github.com/spring-projects/spring-boot/pull/22299 Neo4j Actuator: https://github.com/spring-projects/spring-boot/pull/22302
Please tell me if I did something terrible wrong during the split :)
Comment From: meistermeier
Thanks for the detailed feedback. My plan is to resolve the trivial ones first and see how we can align our changes more with the other Spring Data modules in the discussable cases.
Comment From: snicoll
@meistermeier @michael-simons, thank you both for helping us upgrade to Spring Data Neo4j 6! For consistency with other stores, I had to undo a number of things in your proposal, see https://github.com/snicoll/spring-boot/commit/9bc71fe44fb69f3971edcf7456cf7fc892778870 for more details.
There's a bit more work still. We need to update the documentation (#22652) and I'd like to experiment supporting the spring.data.neo4j
properties again (i.e. the ones used to bootstrap the connection with the client) (#22653)?
Comment From: jagadeesh595
With the latest version of SDN 6.0.0-M2, I have below observation as of now. When we go with either dynamic relationship or Relationship Properties, records are saving in database quickly, but retrieval taking more time compared to Old SDN 5.3.3 version.
In new version, below are the syntaxes to create either dynamic relationship or Relationship Properties,
Syntax for relationship with properties: Below syntax represents Sponsor relationship between two member nodes. MemberSponsor entity contains all relationship properties.
@Relationship(value = "sponsor", direction = Relationship.Direction.OUTGOING)
private Map<Member, MemberSponsor> hasSponsor = new HashMap<>();
Syntax for dynamic relationship without any properties: Below syntax represents Sponsor relationship between two member nodes. In the Map, key-String represents the relationship name, that we can configure dynamically.
@Relationship(direction = Relationship.Direction.OUTGOING)
private Map<String, Member> sponsors = new HashMap<>();
When I am trying to get Member data using below JPA method, system taking more time when any of the above relationships exists in the Member entity class. It is taking 25 mins to get the single Member data using below method from latest version SDN 6.0.0. In old version SDN 5.3.3 – getting same member data within a second. This issue especially occurring only when there is a relationship exists between two nodes with same labels. Here, we are referring relationship between two member nodes of same label.
import org.springframework.data.neo4j.repository.Neo4jRepository;
public interface MemberRepository extends Neo4jRepository<Member, Long> {
Member findByMemberId(String memberId);
}
Can you please help me on this. Seems like issue with retrieval when there is a Dynamic relationship on entity.
Comment From: meistermeier
Thanks @jagadeesh595 for reporting this. Such problems are better placed in the official issue tracker of Spring Data Neo4j: https://jira.spring.io/projects/DATAGRAPH/ I created a ticket for this problem: https://jira.spring.io/browse/DATAGRAPH-1372
Comment From: jagadeesh595
Thanks @jagadeesh595 for reporting this. Such problems are better placed in the official issue tracker of Spring Data Neo4j: https://jira.spring.io/projects/DATAGRAPH/ I created a ticket for this problem: https://jira.spring.io/browse/DATAGRAPH-1372
Thank you for the quick update.
Comment From: jagadeesh595
I am not seeing any response for above question. Hope, we need to reach out to neo4j engineering team.
Comment From: snicoll
@jagadeesh595 there is nothing we can do here I am afraid. Please comment on the Jira issue that is referenced above.
Comment From: michael-simons
Sorry, @snicoll but I like to address this as well.
@jagadeesh595 Thanks for your interested in the new version of SDN coming up. We appreciate that a lot. Please be aware that the Neo4j engineering team is already reading this thread. Also we understand that you are in contact with one of our colleagues from sale. We are answering those questions as well. And we had an eye on the Jira ticket. @meistermeier already sent an E-Mail out to answer all those questions. So, as much as we appreciate your great analysis, let us keep the discussion either indirectly via email or directly on the raised Jira issue. Thanks so much.
To sum it up: When in doubt, use the SDN+OGM coming with Boot 2.3 Our recommendations for new projects is however SDN 6. All the issues raised will be addressed.
Comment From: jagadeesh595
Sorry, @snicoll but I like to address this as well.
@jagadeesh595 Thanks for your interested in the new version of SDN coming up. We appreciate that a lot. Please be aware that the Neo4j engineering team is already reading this thread. Also we understand that you are in contact with one of our colleagues from sale. We are answering those questions as well. And we had an eye on the Jira ticket. @meistermeier already sent an E-Mail out to answer all those questions. So, as much as we appreciate your great analysis, let us keep the discussion either indirectly via email or directly on the raised Jira issue. Thanks so much.
To sum it up: When in doubt, use the SDN+OGM coming with Boot 2.3 Our recommendations for new projects is however SDN 6. All the issues raised will be addressed.
Thanks you Michael! We received answers from your team and communicating through email.