Skip to content

Commit 30e69a7

Browse files
committed
Merge branch '3.4.x'
Closes gh-45236
2 parents 18f4dbd + a73d8d7 commit 30e69a7

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
2525
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2626
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
27+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
2728
import org.springframework.context.annotation.Bean;
2829
import org.springframework.data.neo4j.core.ReactiveDatabaseSelectionProvider;
2930
import org.springframework.data.neo4j.core.ReactiveNeo4jClient;
@@ -44,6 +45,7 @@
4445
@AutoConfiguration(after = Neo4jDataAutoConfiguration.class)
4546
@ConditionalOnClass({ Driver.class, ReactiveNeo4jTemplate.class, ReactiveTransactionManager.class, Flux.class })
4647
@ConditionalOnBean(Driver.class)
48+
@EnableConfigurationProperties(Neo4jDataProperties.class)
4749
public class Neo4jReactiveDataAutoConfiguration {
4850

4951
@Bean
@@ -63,6 +65,7 @@ public ReactiveNeo4jClient reactiveNeo4jClient(Driver driver,
6365

6466
@Bean(ReactiveNeo4jRepositoryConfigurationExtension.DEFAULT_NEO4J_TEMPLATE_BEAN_NAME)
6567
@ConditionalOnMissingBean(ReactiveNeo4jOperations.class)
68+
@ConditionalOnBean(Neo4jMappingContext.class)
6669
public ReactiveNeo4jTemplate reactiveNeo4jTemplate(ReactiveNeo4jClient neo4jClient,
6770
Neo4jMappingContext neo4jMappingContext) {
6871
return new ReactiveNeo4jTemplate(neo4jClient, neo4jMappingContext);

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

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,6 +56,14 @@ class Neo4jReactiveDataAutoConfigurationTests {
5656
.withConfiguration(AutoConfigurations.of(Neo4jAutoConfiguration.class, Neo4jDataAutoConfiguration.class,
5757
Neo4jReactiveDataAutoConfiguration.class));
5858

59+
@Test
60+
void shouldBackOffIfNoMappingContextIsProvided() {
61+
new ApplicationContextRunner().withUserConfiguration(MockedDriverConfiguration.class)
62+
.withConfiguration(
63+
AutoConfigurations.of(Neo4jAutoConfiguration.class, Neo4jReactiveDataAutoConfiguration.class))
64+
.run((context) -> assertThat(context).doesNotHaveBean(Neo4jMappingContext.class));
65+
}
66+
5967
@Test
6068
void shouldProvideDefaultDatabaseNameProvider() {
6169
this.contextRunner.run((context) -> {

0 commit comments

Comments
 (0)