-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Upgrade to Spring Data Neo4j 6 #22299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Spring Data Neo4j 6 #22299
Conversation
6d69ff8
to
2ed8a59
Compare
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. |
Thanks for your quick response, Andy. |
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. |
2ed8a59
to
b7fa3d1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for the PR.
I've made a first pass and that's indeed a lot to take in but this work is super useful to me as I am not familiar with Spring Data Neo4j 6 yet.
I've made quite a lot of comments. Most are formatting and consistency thing that we can easily fix but there are a few that might requite some additional discussion. Can you please have a look to these? Do not hesitate if something isn't clear.
.../main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java
Outdated
Show resolved
Hide resolved
.../main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java
Show resolved
Hide resolved
...ure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataProperties.java
Outdated
Show resolved
Hide resolved
...ure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataProperties.java
Show resolved
Hide resolved
...mework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfigurationIntegrationTests.java
Show resolved
Hide resolved
.hasSingleBean(ReactiveCountryRepository.class)); | ||
} | ||
|
||
@Configuration |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency this should have proxyBeanMethods = false
.
.../java/org/springframework/boot/test/autoconfigure/data/neo4j/DataNeo4jTypeExcludeFilter.java
Outdated
Show resolved
Hide resolved
@AutoConfigureDataNeo4j | ||
@ImportAutoConfiguration | ||
@Import(ReactiveCapableNeo4jVersionAssertion.class) | ||
public @interface ReactiveDataNeo4jTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the other store has a reactive specific variant so I am not keen to introduce that. Perhaps the need of a specific annotation surfaces another problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will target this together with the reactive AutoConfiguration
suggestion in the next iteration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checked this one and the reasons why we have chosen to introduce a parallel annotation for reactive is some convenience features:
Fail on database < 4.0 (https://github.com/spring-projects/spring-boot/pull/22299/files/b7fa3d1faca912a7c384ec3c20ca93a8fb3b21a8#diff-31539ed0ee3ec3e7c3a490aaa41e5db5R50)
and setting the spring.data.neo4j.repositories.type
to reactive (https://github.com/spring-projects/spring-boot/pull/22299/files/b7fa3d1faca912a7c384ec3c20ca93a8fb3b21a8#diff-31539ed0ee3ec3e7c3a490aaa41e5db5R50)
Arguably this might be too less features for introducing this parallel infrastructure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the other stores have such a variant and I am not keen to introduce it as part of the upgrade. We can reconsider once the upgrade is done of course.
...spring-boot-smoke-test-data-neo4j/src/main/java/smoketest/data/neo4j/CustomerRepository.java
Outdated
Show resolved
Hide resolved
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. |
This commit will update the Spring Data Neo4j Spring Boot starter, autoconfig and actuator. It will also bring in autoconfiguration for the Neo4j Java driver to enable users to work with a managed instance of the driver without the high level abstraction of Spring Data.
Until we decided what to do with the reactive and imperative auto-configuration, we will keep both. To remove the `@Nested` annotation but keep it readable the tests get split up into different classes.
a3b2305
to
eacfd19
Compare
@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 snicoll@9bc71fe 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 |
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. |
Thanks @jagadeesh595 for reporting this. |
Thank you for the quick update. |
This PR adapts Spring Boot 2.4 to Spring Data Neo4j 6.
For some background:
Neo4j has developed two projects in the last year
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
spring.neo4j
, similar to others (like mongo and redis)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.