diff --git a/spring-boot-autoconfigure/pom.xml b/spring-boot-autoconfigure/pom.xml index 54bcf3e5ab..84f77dccab 100755 --- a/spring-boot-autoconfigure/pom.xml +++ b/spring-boot-autoconfigure/pom.xml @@ -716,6 +716,11 @@ hsqldb test + + org.neo4j + neo4j-ogm-http-driver + test + org.springframework spring-test diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java index 90578ec534..86053be22f 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfiguration.java @@ -18,6 +18,7 @@ package org.springframework.boot.autoconfigure.data.neo4j; import java.util.List; +import org.neo4j.ogm.config.Components; import org.neo4j.ogm.session.SessionFactory; import org.neo4j.ogm.session.event.EventListener; @@ -37,8 +38,6 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.data.neo4j.template.Neo4jOperations; -import org.springframework.data.neo4j.template.Neo4jTemplate; import org.springframework.data.neo4j.transaction.Neo4jTransactionManager; import org.springframework.data.neo4j.web.support.OpenSessionInViewInterceptor; import org.springframework.transaction.PlatformTransactionManager; @@ -60,13 +59,15 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @ConditionalOnClass({ SessionFactory.class, PlatformTransactionManager.class }) @ConditionalOnMissingBean(SessionFactory.class) @EnableConfigurationProperties(Neo4jProperties.class) -@SuppressWarnings("deprecation") public class Neo4jDataAutoConfiguration { @Bean @ConditionalOnMissingBean public org.neo4j.ogm.config.Configuration configuration(Neo4jProperties properties) { - return properties.createConfiguration(); + org.neo4j.ogm.config.Configuration configuration = properties + .createConfiguration(); + Components.configure(configuration); + return configuration; } @Bean @@ -84,12 +85,6 @@ public class Neo4jDataAutoConfiguration { return sessionFactory; } - @Bean - @ConditionalOnMissingBean(Neo4jOperations.class) - public Neo4jTemplate neo4jTemplate(SessionFactory sessionFactory) { - return new Neo4jTemplate(sessionFactory); - } - @Bean @ConditionalOnMissingBean(PlatformTransactionManager.class) public Neo4jTransactionManager transactionManager(SessionFactory sessionFactory, 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 e58bda102b..207868102a 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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 driverConfiguration) { + private void configureDriver(Configuration configuration) { if (this.uri != null) { - configureDriverFromUri(driverConfiguration, this.uri); + configureDriverFromUri(configuration, this.uri); } else { - configureDriverWithDefaults(driverConfiguration); + configureDriverWithDefaults(configuration); } if (this.username != null && this.password != null) { - driverConfiguration.setCredentials(this.username, this.password); + configuration.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 driverConfiguration) { + private void configureDriverWithDefaults(Configuration configuration) { if (getEmbedded().isEnabled() && ClassUtils.isPresent(EMBEDDED_DRIVER, this.classLoader)) { - driverConfiguration.setDriverClassName(EMBEDDED_DRIVER); + configuration.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 { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java index 142fff319c..b86be7189d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jRepositoriesAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension; import org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactoryBean; @@ -35,9 +35,9 @@ import org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactoryB * Repositories. *

* Activates when there is no bean of type {@link Neo4jRepositoryFactoryBean} configured - * in the context, the Spring Data Neo4j {@link GraphRepository} type is on the classpath, + * in the context, the Spring Data Neo4j {@link Neo4jRepository} type is on the classpath, * the Neo4j client driver API is on the classpath, and there is no other configured - * {@link GraphRepository}. + * {@link Neo4jRepository}. *

* Once in effect, the auto-configuration is the equivalent of enabling Neo4j repositories * using the {@link EnableNeo4jRepositories} annotation. @@ -49,7 +49,7 @@ import org.springframework.data.neo4j.repository.support.Neo4jRepositoryFactoryB * @see EnableNeo4jRepositories */ @Configuration -@ConditionalOnClass({ Neo4jSession.class, GraphRepository.class }) +@ConditionalOnClass({ Neo4jSession.class, Neo4jRepository.class }) @ConditionalOnMissingBean({ Neo4jRepositoryFactoryBean.class, Neo4jRepositoryConfigurationExtension.class }) @ConditionalOnProperty(prefix = "spring.data.neo4j.repositories", name = "enabled", havingValue = "true", matchIfMissing = true) diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/neo4j/CityNeo4jRepository.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/neo4j/CityNeo4jRepository.java index a4acf364e3..8d997cd792 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/neo4j/CityNeo4jRepository.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/alt/neo4j/CityNeo4jRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -17,8 +17,8 @@ package org.springframework.boot.autoconfigure.data.alt.neo4j; import org.springframework.boot.autoconfigure.data.neo4j.city.City; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; -public interface CityNeo4jRepository extends GraphRepository { +public interface CityNeo4jRepository extends Neo4jRepository { } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java index 3cf5470a5a..1f02aa642f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/Neo4jDataAutoConfigurationTests.java @@ -30,6 +30,8 @@ import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.boot.autoconfigure.AutoConfigurationPackages; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; import org.springframework.boot.autoconfigure.data.neo4j.city.City; +import org.springframework.boot.autoconfigure.data.neo4j.country.Country; +import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration; import org.springframework.boot.test.util.EnvironmentTestUtils; import org.springframework.context.ConfigurableApplicationContext; @@ -37,7 +39,6 @@ import org.springframework.context.annotation.AnnotationConfigApplicationContext import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.neo4j.mapping.Neo4jMappingContext; -import org.springframework.data.neo4j.template.Neo4jOperations; import org.springframework.data.neo4j.transaction.Neo4jTransactionManager; import org.springframework.data.neo4j.web.support.OpenSessionInViewInterceptor; import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -57,7 +58,6 @@ import static org.mockito.Mockito.verify; * @author Andy Wilkinson * @author Kazuki Shimizu */ -@SuppressWarnings("deprecation") public class Neo4jDataAutoConfigurationTests { private ConfigurableApplicationContext context; @@ -75,7 +75,6 @@ public class Neo4jDataAutoConfigurationTests { assertThat(this.context.getBeansOfType(org.neo4j.ogm.config.Configuration.class)) .hasSize(1); assertThat(this.context.getBeansOfType(SessionFactory.class)).hasSize(1); - assertThat(this.context.getBeansOfType(Neo4jOperations.class)).hasSize(1); assertThat(this.context.getBeansOfType(Neo4jTransactionManager.class)).hasSize(1); assertThat(this.context.getBeansOfType(OpenSessionInViewInterceptor.class)) .hasSize(1); @@ -109,13 +108,6 @@ public class Neo4jDataAutoConfigurationTests { .hasSize(1); } - @Test - public void customNeo4jOperations() { - load(CustomNeo4jOperations.class); - assertThat(this.context.getBean(Neo4jOperations.class)) - .isSameAs(this.context.getBean("myNeo4jOperations")); - } - @Test public void usesAutoConfigurationPackageToPickUpDomainTypes() { this.context = new AnnotationConfigApplicationContext(); @@ -154,7 +146,7 @@ public class Neo4jDataAutoConfigurationTests { if (config != null) { ctx.register(config); } - ctx.register(PropertyPlaceholderAutoConfiguration.class, + ctx.register(TestConfiguration.class, PropertyPlaceholderAutoConfiguration.class, TransactionAutoConfiguration.class, Neo4jDataAutoConfiguration.class); ctx.refresh(); this.context = ctx; @@ -167,6 +159,12 @@ public class Neo4jDataAutoConfigurationTests { } } + @Configuration + @EntityScan(basePackageClasses = Country.class) + static class TestConfiguration { + + } + @Configuration static class CustomSessionFactory { @@ -183,23 +181,12 @@ public class Neo4jDataAutoConfigurationTests { @Bean public org.neo4j.ogm.config.Configuration myConfiguration() { org.neo4j.ogm.config.Configuration configuration = new org.neo4j.ogm.config.Configuration(); - configuration.driverConfiguration() - .setDriverClassName(HttpDriver.class.getName()); + configuration.setDriverClassName(HttpDriver.class.getName()); return configuration; } } - @Configuration - static class CustomNeo4jOperations { - - @Bean - public Neo4jOperations myNeo4jOperations() { - return mock(Neo4jOperations.class); - } - - } - @Configuration static class EventListenerConfiguration { 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 6ee0b993e0..6439f8faa4 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 @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -22,9 +22,8 @@ import java.net.URLClassLoader; import com.hazelcast.util.Base64; import org.junit.After; import org.junit.Test; -import org.neo4j.ogm.authentication.Credentials; import org.neo4j.ogm.config.Configuration; -import org.neo4j.ogm.config.DriverConfiguration; +import org.neo4j.ogm.config.Credentials; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.test.util.EnvironmentTestUtils; @@ -56,15 +55,15 @@ public class Neo4jPropertiesTests { } @Test - public void defaultUseHttpDriverIfEmbeddedDriverIsNotAvailable() { + public void defaultUseBoltDriverIfEmbeddedDriverIsNotAvailable() { Neo4jProperties properties = load(false); Configuration configuration = properties.createConfiguration(); - assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, - Neo4jProperties.DEFAULT_HTTP_URI); + assertDriver(configuration, Neo4jProperties.BOLT_DRIVER, + Neo4jProperties.DEFAULT_BOLT_URI); } @Test - public void httpUriUseHttpServer() { + public void httpUriUseHttpDriver() { Neo4jProperties properties = load(true, "spring.data.neo4j.uri=http://localhost:7474"); Configuration configuration = properties.createConfiguration(); @@ -109,12 +108,12 @@ public class Neo4jPropertiesTests { } @Test - public void embeddedModeDisabledUseHttpUri() { + public void embeddedModeDisabledUseBoltUri() { Neo4jProperties properties = load(true, "spring.data.neo4j.embedded.enabled=false"); Configuration configuration = properties.createConfiguration(); - assertDriver(configuration, Neo4jProperties.HTTP_DRIVER, - Neo4jProperties.DEFAULT_HTTP_URI); + assertDriver(configuration, Neo4jProperties.BOLT_DRIVER, + Neo4jProperties.DEFAULT_BOLT_URI); } @Test @@ -128,14 +127,13 @@ public class Neo4jPropertiesTests { private static void assertDriver(Configuration actual, String driver, String uri) { assertThat(actual).isNotNull(); - DriverConfiguration driverConfig = actual.driverConfiguration(); - assertThat(driverConfig.getDriverClassName()).isEqualTo(driver); - assertThat(driverConfig.getURI()).isEqualTo(uri); + assertThat(actual.getDriverClassName()).isEqualTo(driver); + assertThat(actual.getURI()).isEqualTo(uri); } private static void assertCredentials(Configuration actual, String username, String password) { - Credentials credentials = actual.driverConfiguration().getCredentials(); + Credentials credentials = actual.getCredentials(); if (username == null & password == null) { assertThat(credentials).isNull(); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/CityRepository.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/CityRepository.java index 051c0622e0..b9e37f4d6e 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/CityRepository.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/city/CityRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -18,9 +18,9 @@ package org.springframework.boot.autoconfigure.data.neo4j.city; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; -public interface CityRepository extends GraphRepository { +public interface CityRepository extends Neo4jRepository { @Override Page findAll(Pageable pageable); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/CountryRepository.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/CountryRepository.java index a3180af6d8..cbfa9b1111 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/CountryRepository.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/data/neo4j/country/CountryRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -16,8 +16,8 @@ package org.springframework.boot.autoconfigure.data.neo4j.country; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; -public interface CountryRepository extends GraphRepository { +public interface CountryRepository extends Neo4jRepository { } diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml index 244ed91c68..0c152ab9d7 100644 --- a/spring-boot-dependencies/pom.xml +++ b/spring-boot-dependencies/pom.xml @@ -137,7 +137,7 @@ 5.1.41 5.5.3.Final 1.9.22 - 2.1.1 + 3.0.0-SNAPSHOT 4.1.8.Final 9.4.1212.jre7 4.1.4 @@ -1890,6 +1890,11 @@ neo4j-ogm-api ${neo4j-ogm.version} + + org.neo4j + neo4j-ogm-bolt-driver + ${neo4j-ogm.version} + org.neo4j neo4j-ogm-compiler @@ -2647,6 +2652,13 @@ false + + neo4j-snapshots + http://m2.neo4j.org/content/repositories/snapshots + + true + + diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index cf40ee6efd..5a03283504 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -597,7 +597,6 @@ content into your application; rather pick only the properties that you need. spring.data.redis.repositories.enabled=true # Enable Redis repositories. # NEO4J ({sc-spring-boot-autoconfigure}/neo4j/Neo4jProperties.{sc-ext}[Neo4jProperties]) - spring.data.neo4j.compiler= # Compiler to use. spring.data.neo4j.embedded.enabled=true # Enable embedded mode if the embedded driver is available. spring.data.neo4j.open-in-view=false # Register OpenSessionInViewInterceptor. Binds a Neo4j Session to the thread for the entire processing of the request. spring.data.neo4j.password= # Login password of the server. diff --git a/spring-boot-parent/pom.xml b/spring-boot-parent/pom.xml index c5a89b8192..bbca4bf22e 100644 --- a/spring-boot-parent/pom.xml +++ b/spring-boot-parent/pom.xml @@ -689,6 +689,13 @@ false + + neo4j-snapshots + http://m2.neo4j.org/content/repositories/snapshots + + true + + @@ -754,6 +761,13 @@ false + + neo4j-snapshots + http://m2.neo4j.org/content/repositories/snapshots + + true + + @@ -838,6 +852,13 @@ false + + neo4j-snapshots + http://m2.neo4j.org/content/repositories/snapshots + + true + + diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java index bff25dddcf..518b991dec 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/main/java/sample/data/neo4j/CustomerRepository.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -18,9 +18,9 @@ package sample.data.neo4j; import java.util.List; -import org.springframework.data.neo4j.repository.GraphRepository; +import org.springframework.data.neo4j.repository.Neo4jRepository; -public interface CustomerRepository extends GraphRepository { +public interface CustomerRepository extends Neo4jRepository { public Customer findByFirstName(String firstName); diff --git a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java index 728fde7ce1..9b06667357 100644 --- a/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-data-neo4j/src/test/java/sample/data/neo4j/SampleNeo4jApplicationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2017 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. @@ -16,10 +16,9 @@ package sample.data.neo4j; -import java.net.ConnectException; - import org.junit.Rule; import org.junit.Test; +import org.neo4j.driver.v1.exceptions.ServiceUnavailableException; import org.springframework.boot.test.rule.OutputCapture; @@ -51,8 +50,7 @@ public class SampleNeo4jApplicationTests { } private boolean neo4jServerRunning(Throwable ex) { - System.out.println(ex.getMessage()); - if (ex instanceof ConnectException) { + if (ex instanceof ServiceUnavailableException) { return false; } return (ex.getCause() == null || neo4jServerRunning(ex.getCause()));