Reputation: 3
What is the best way to configure a Spring Boot application to connect to GrapheneDB on Heroku? My spring boot application was configured to connect with my locally installed neo4j, after deploying the application and the dataset on graphenedb, nothing is working. I believe I have to make some changes on my application.properties file but I have no idea how to do it. Currently my application.properties file looks like this,
#neo4j
spring.data.neo4j.username=neo4j
spring.data.neo4j.password=2bernadette
spring.data.neo4j.repositories.enabled=true
spring.data.neo4j.open-in-view=false
Thanks in advance
Upvotes: 0
Views: 423
Reputation: 11
You can also connect via Bolt Protocol. Its credentials can be found out by typing the following commands into Heroku CLI:
heroku config:get GRAPHENEDB_BOLT_URL
heroku config:get GRAPHENEDB_URL
heroku config:get GRAPHENEDB_USER
heroku config:get GRAPHENEDB_PASSWORD
Then just enter the info you got into application.properties file, such as:
spring.data.neo4j.uri=<BOLT_URI>
spring.data.neo4j.username=<USERNAME>
spring.data.neo4j.password=<PASSWORD>
And you're pretty much all set.
Source: https://devcenter.heroku.com/articles/graphenedb
Upvotes: 0
Reputation: 3
Well after four days researching, I was able to find out that the best way to connect to GrapheneDB is to use the http Driver.
So you have to add a dependency on your pom file,
<dependency>
<scope>runtime</scope>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-ogm-http-driver</artifactId>
<version>${neo4j-ogm.version}</version>
</dependency>
Then you need to include this configuration in your application class (Where you placed your main method). Kindly place it before,
@Bean
public org.neo4j.ogm.config.Configuration getConfiguration() {
org.neo4j.ogm.config.Configuration config = new org.neo4j.ogm.config.Configuration();
config
.driverConfiguration()
.setDriverClassName("org.neo4j.ogm.drivers.http.driver.HttpDriver")
.setURI("GRAPHENEDB_URL"); //Replace this string with the real url in quotes
return config;
}
You are supposed to import org.neo4j.ogm.config.Configuration but in order to avoid ambiguity, It made it this way.
After that, you should be fine. :)
Upvotes: 0