Browse Source

Start building against Spring Data 2021.0.0-M5 snapshots

See gh-25548
pull/25617/head
Stephane Nicoll 5 years ago
parent
commit
46baf462ac
  1. 9
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java
  2. 11
      spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java
  3. 16
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java
  4. 16
      spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfigurationTests.java
  5. 2
      spring-boot-project/spring-boot-dependencies/build.gradle

9
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java

@ -94,15 +94,14 @@ public class Neo4jDataAutoConfiguration { @@ -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)

11
spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfiguration.java

@ -1,5 +1,5 @@ @@ -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 { @@ -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);
}
}

16
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java

@ -97,6 +97,15 @@ class Neo4jDataAutoConfigurationTests { @@ -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 { @@ -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

16
spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jReactiveDataAutoConfigurationTests.java

@ -91,6 +91,16 @@ class Neo4jReactiveDataAutoConfigurationTests { @@ -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 { @@ -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

2
spring-boot-project/spring-boot-dependencies/build.gradle

@ -1621,7 +1621,7 @@ bom { @@ -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