@ -1,5 +1,5 @@
/ *
* Copyright 2012 - 201 6 the original author or authors .
* Copyright 2012 - 201 7 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 .
@ -20,7 +20,6 @@ import java.net.URI;
import java.net.URISyntaxException ;
import org.neo4j.ogm.config.Configuration ;
import org.neo4j.ogm.config.DriverConfiguration ;
import org.springframework.beans.BeansException ;
import org.springframework.boot.context.properties.ConfigurationProperties ;
@ -43,7 +42,7 @@ public class Neo4jProperties implements ApplicationContextAware {
static final String HTTP_DRIVER = "org.neo4j.ogm.drivers.http.driver.HttpDriver" ;
static final String DEFAULT_ HTTP_URI = "http://localhost:7474 ";
static final String DEFAULT_ BOLT_URI = "bolt://localhost:7687 ";
static final String BOLT_DRIVER = "org.neo4j.ogm.drivers.bolt.driver.BoltDriver" ;
@ -62,11 +61,6 @@ public class Neo4jProperties implements ApplicationContextAware {
* /
private String password ;
/ * *
* Compiler to use .
* /
private String compiler ;
private final Embedded embedded = new Embedded ( ) ;
private ClassLoader classLoader = Neo4jProperties . class . getClassLoader ( ) ;
@ -95,14 +89,6 @@ public class Neo4jProperties implements ApplicationContextAware {
this . password = password ;
}
public String getCompiler ( ) {
return this . compiler ;
}
public void setCompiler ( String compiler ) {
this . compiler = compiler ;
}
public Embedded getEmbedded ( ) {
return this . embedded ;
}
@ -118,29 +104,25 @@ public class Neo4jProperties implements ApplicationContextAware {
* /
public Configuration createConfiguration ( ) {
Configuration configuration = new Configuration ( ) ;
configureDriver ( configuration . driverConfiguration ( ) ) ;
if ( this . compiler ! = null ) {
configuration . compilerConfiguration ( ) . setCompilerClassName ( this . compiler ) ;
}
configureDriver ( configuration ) ;
return configuration ;
}
private void configureDriver ( DriverConfiguration driverC onfiguration) {
private void configureDriver ( Configuration c onfiguration) {
if ( this . uri ! = null ) {
configureDriverFromUri ( driverC onfiguration, this . uri ) ;
configureDriverFromUri ( c onfiguration, this . uri ) ;
}
else {
configureDriverWithDefaults ( driverC onfiguration) ;
configureDriverWithDefaults ( c onfiguration) ;
}
if ( this . username ! = null & & this . password ! = null ) {
driverC onfiguration. setCredentials ( this . username , this . password ) ;
c onfiguration. setCredentials ( this . username , this . password ) ;
}
}
private void configureDriverFromUri ( DriverConfiguration driverConfiguration ,
String uri ) {
driverConfiguration . setDriverClassName ( deduceDriverFromUri ( ) ) ;
driverConfiguration . setURI ( uri ) ;
private void configureDriverFromUri ( Configuration configuration , String uri ) {
configuration . setDriverClassName ( deduceDriverFromUri ( ) ) ;
configuration . setURI ( uri ) ;
}
private String deduceDriverFromUri ( ) {
@ -165,14 +147,14 @@ public class Neo4jProperties implements ApplicationContextAware {
}
}
private void configureDriverWithDefaults ( DriverConfiguration driverC onfiguration) {
private void configureDriverWithDefaults ( Configuration c onfiguration) {
if ( getEmbedded ( ) . isEnabled ( )
& & ClassUtils . isPresent ( EMBEDDED_DRIVER , this . classLoader ) ) {
driverC onfiguration. setDriverClassName ( EMBEDDED_DRIVER ) ;
c onfiguration. setDriverClassName ( EMBEDDED_DRIVER ) ;
return ;
}
driverConfiguration. setDriverClassName ( HTTP _DRIVER) ;
driverConfiguration. setURI ( DEFAULT_HTTP _URI) ;
configuration. setDriverClassName ( BOLT _DRIVER) ;
configuration. setURI ( DEFAULT_BOLT _URI) ;
}
public static class Embedded {