diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java index f85b56b83a..e58bda102b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jProperties.java @@ -45,6 +45,8 @@ public class Neo4jProperties implements ApplicationContextAware { static final String DEFAULT_HTTP_URI = "http://localhost:7474"; + static final String BOLT_DRIVER = "org.neo4j.ogm.drivers.bolt.driver.BoltDriver"; + /** * URI used by the driver. Auto-detected by default. */ @@ -151,6 +153,9 @@ public class Neo4jProperties implements ApplicationContextAware { if ("http".equals(scheme)) { return HTTP_DRIVER; } + if ("bolt".equals(scheme)) { + return BOLT_DRIVER; + } throw new IllegalArgumentException( "Could not deduce driver to use based on URI '" + uri + "'"); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jPropertiesTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jPropertiesTests.java index 5e87643512..6ee0b993e0 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jPropertiesTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jPropertiesTests.java @@ -71,6 +71,14 @@ public class Neo4jPropertiesTests { assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, "http://localhost:7474"); } + @Test + public void boltUriUseBoltDriver() { + Neo4jProperties properties = load(true, + "spring.data.neo4j.uri=bolt://localhost:7687"); + Configuration configuration = properties.createConfiguration(); + assertDriver(configuration, Neo4jProperties.BOLT_DRIVER, "bolt://localhost:7687"); + } + @Test public void fileUriUseEmbeddedServer() { Neo4jProperties properties = load(true,