Skip to content
This repository was archived by the owner on Sep 1, 2023. It is now read-only.

Commit ac110a9

Browse files
GH-21 - Clarify defaults and requirements of org.neo4j.driver.uri property.
1 parent 1848afd commit ac110a9

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

docs/appendix/configuration-options.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070

7171
|`{config_prefix}.uri`
7272
|
73-
|+++The uri this driver should connect to. The driver supports bolt, bolt+routing or neo4j as schemes. The default URI is 'bolt://localhost:7687'.+++
73+
|+++The uri this driver should connect to. The driver supports bolt or neo4j as schemes. The starter does not provide a default URI so that clashes with the SDN/OGM Spring Boot starter are avoided.+++
7474

7575
|`{config_prefix}.pool.metrics-enabled`
7676
|`false`

docs/manual/getting-started.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ org.neo4j.driver.authentication.username=neo4j
121121
org.neo4j.driver.authentication.password=secret
122122
----
123123

124+
IMPORTANT: The URI is required. Autoconfiguration will not be triggered without it.
125+
This is to avoid clashes with the Spring Boot SDN/OGM starter.
126+
The SDN/OGM starter defaults to localhost, but backs off when it detects a driver bean.
127+
If this starter here would default to localhost as well, a driver bean would always be
128+
provided and SDN/OGM would back off even when a user configured a different URI.
129+
124130
This is the bare minimum of what you need to connect to a Neo4j instance.
125131

126132
Refer to <<Configuration options,the list of configuration properties>> for all options this driver supports.

neo4j-java-driver-spring-boot-autoconfigure/src/main/java/org/neo4j/driver/springframework/boot/autoconfigure/Neo4jDriverProperties.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public class Neo4jDriverProperties {
4444
/**
4545
* The uri this driver should connect to. The driver supports bolt or neo4j as schemes.
4646
*/
47-
private URI uri = URI.create("bolt://localhost:7687");
47+
private URI uri;
4848

4949
/**
5050
* The authentication the driver is supposed to use. Maybe null.

neo4j-java-driver-spring-boot-autoconfigure/src/test/java/org/neo4j/driver/springframework/boot/autoconfigure/Neo4jDriverPropertiesTest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ void trustCustomCertificatesShouldWork1() throws IOException {
356356

357357
@Test
358358
@DisplayName("…should fail on custom certificates without cert file")
359-
void trustCustomCertificatesShouldWork2() throws IOException {
359+
void trustCustomCertificatesShouldWork2() {
360360

361361
TrustSettings settings = new TrustSettings();
362362
settings.setStrategy(Strategy.TRUST_CUSTOM_CA_SIGNED_CERTIFICATES);
@@ -368,6 +368,14 @@ void trustCustomCertificatesShouldWork2() throws IOException {
368368
}
369369
}
370370

371+
@Test
372+
@DisplayName("Should not assume default value for the URL")
373+
void shouldNotAssumeDefaultValuesForUrl() {
374+
375+
Neo4jDriverProperties driverProperties = new Neo4jDriverProperties();
376+
assertThat(driverProperties.getUri()).isNull();
377+
}
378+
371379
@Configuration(proxyBeanMethods = false)
372380
@EnableConfigurationProperties(Neo4jDriverProperties.class)
373381
static class TestConfiguration {

0 commit comments

Comments
 (0)