Start building against Spring Data 2021.0.0-M5 snapshots

See gh-25548
pull/25617/head
Stephane Nicoll 4 years ago
parent c19e5c9212
commit 46baf462ac

@ -94,15 +94,14 @@ public class Neo4jDataAutoConfiguration {
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_CLIENT_BEAN_NAME)
@ConditionalOnMissingBean
public Neo4jClient neo4jClient(Driver driver) {
return Neo4jClient.create(driver);
public Neo4jClient neo4jClient(Driver driver, DatabaseSelectionProvider databaseNameProvider) {
return Neo4jClient.create(driver, databaseNameProvider);
}
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)
@ConditionalOnMissingBean(Neo4jOperations.class)
public Neo4jTemplate neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext,
DatabaseSelectionProvider databaseNameProvider) {
return new Neo4jTemplate(neo4jClient, neo4jMappingContext, databaseNameProvider);
public Neo4jTemplate neo4jTemplate(Neo4jClient neo4jClient, Neo4jMappingContext neo4jMappingContext) {
return new Neo4jTemplate(neo4jClient, neo4jMappingContext);
}
@Bean(Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -58,15 +58,16 @@ public class Neo4jReactiveDataAutoConfiguration {
@Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_CLIENT_BEAN_NAME)
@ConditionalOnMissingBean
public ReactiveNeo4jClient reactiveNeo4jClient(Driver driver) {
return ReactiveNeo4jClient.create(driver);
public ReactiveNeo4jClient reactiveNeo4jClient(Driver driver,
ReactiveDatabaseSelectionProvider databaseNameProvider) {
return ReactiveNeo4jClient.create(driver, databaseNameProvider);
}
@Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)
@ConditionalOnMissingBean(ReactiveNeo4jOperations.class)
public ReactiveNeo4jTemplate reactiveNeo4jTemplate(ReactiveNeo4jClient neo4jClient,
Neo4jMappingContext neo4jMappingContext, ReactiveDatabaseSelectionProvider databaseNameProvider) {
return new ReactiveNeo4jTemplate(neo4jClient, neo4jMappingContext, databaseNameProvider);
Neo4jMappingContext neo4jMappingContext) {
return new ReactiveNeo4jTemplate(neo4jClient, neo4jMappingContext);
}
}

@ -97,6 +97,15 @@ class Neo4jDataAutoConfigurationTests {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(Neo4jClient.class));
}
@Test
void shouldProvideNeo4jClientWithCustomDatabaseSelectionProvider() {
this.contextRunner.withUserConfiguration(CustomDatabaseSelectionProviderConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Neo4jClient.class);
assertThat(context.getBean(Neo4jClient.class)).extracting("databaseSelectionProvider")
.isSameAs(context.getBean(DatabaseSelectionProvider.class));
});
}
@Test
void shouldReuseExistingNeo4jClient() {
this.contextRunner.withBean("myCustomClient", Neo4jClient.class, () -> mock(Neo4jClient.class))
@ -105,11 +114,8 @@ class Neo4jDataAutoConfigurationTests {
@Test
void shouldProvideNeo4jTemplate() {
this.contextRunner.withUserConfiguration(CustomDatabaseSelectionProviderConfiguration.class).run((context) -> {
assertThat(context).hasSingleBean(Neo4jTemplate.class);
assertThat(context.getBean(Neo4jTemplate.class)).extracting("databaseSelectionProvider")
.isSameAs(context.getBean(DatabaseSelectionProvider.class));
});
this.contextRunner.withUserConfiguration(CustomDatabaseSelectionProviderConfiguration.class)
.run((context) -> assertThat(context).hasSingleBean(Neo4jTemplate.class));
}
@Test

@ -91,6 +91,16 @@ class Neo4jReactiveDataAutoConfigurationTests {
this.contextRunner.run((context) -> assertThat(context).hasSingleBean(ReactiveNeo4jClient.class));
}
@Test
void shouldProvideReactiveNeo4jClientWithCustomDatabaseSelectionProvider() {
this.contextRunner.withUserConfiguration(CustomReactiveDatabaseSelectionProviderConfiguration.class)
.run((context) -> {
assertThat(context).hasSingleBean(ReactiveNeo4jClient.class);
assertThat(context.getBean(ReactiveNeo4jClient.class)).extracting("databaseSelectionProvider")
.isSameAs(context.getBean(ReactiveDatabaseSelectionProvider.class));
});
}
@Test
void shouldReuseExistingReactiveNeo4jClient() {
this.contextRunner
@ -102,11 +112,7 @@ class Neo4jReactiveDataAutoConfigurationTests {
@Test
void shouldProvideReactiveNeo4jTemplate() {
this.contextRunner.withUserConfiguration(CustomReactiveDatabaseSelectionProviderConfiguration.class)
.run((context) -> {
assertThat(context).hasSingleBean(ReactiveNeo4jTemplate.class);
assertThat(context.getBean(ReactiveNeo4jTemplate.class)).extracting("databaseSelectionProvider")
.isSameAs(context.getBean(ReactiveDatabaseSelectionProvider.class));
});
.run((context) -> assertThat(context).hasSingleBean(ReactiveNeo4jTemplate.class));
}
@Test

@ -1621,7 +1621,7 @@ bom {
]
}
}
library("Spring Data Bom", "2021.0.0-M4") {
library("Spring Data Bom", "2021.0.0-SNAPSHOT") {
group("org.springframework.data") {
imports = [
"spring-data-bom"

Loading…
Cancel
Save