i want to use neo4j in my application. I already tried my code using the embedded database, but i want to connect to an existing database. My configuration looks like this:
@Configuration
@EnableNeo4jRepositories(basePackages = "de.kevin.catAppNeo4j")
public class ApplicationConfig extends Neo4jConfiguration {
public ApplicationConfig() {
setBasePackage("de.kevin.catAppNeo4j");
}
@Bean
GraphDatabaseService graphDatabaseService() {
return new SpringRestGraphDatabase("http://localhost:7474/db/data/");
}
}
My Application looks like this:
@SpringBootApplication
public class Application implements CommandLineRunner {
@Autowired
ElementRepository personRepository;
@Autowired
GraphDatabase graphDatabase;
@Override
public void run(String... args) throws Exception {
Element e1 = new Element("USER", "page");
try (Transaction tx = graphDatabase.beginTx()){
personRepository.save(e1);
[...]
tx.success();
}
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
Then theres a node element, a repository and a relationship, which probably shouldnt matter.
My pom.xml has these dependencies
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j-rest</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-neo4j</artifactId>
</dependency>
</dependencies>
If i try to connect to my server running on localhost:7474 i get this exceptionstack http://ift.tt/1DPrKvX
Aucun commentaire:
Enregistrer un commentaire