cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Is it possible to run database from Spring application

I am wondering if It's possible to start a Neo4J database directly from the Spring application. Right now, when I want to connect with my database I have to lauch Neo4J Desktop first and start a certain database so I can then connect it to my spring appliaction

This is the configuration class I use to connect wih the database

@Configuration
@EnableNeo4jRepositories(basePackages = "com.example.neo4j_example_1.repository")
@EnableTransactionManagement
public class Neo4jConfig {

    @Bean
    public SessionFactory sessionFactory() {
        return new SessionFactory(configuration(), "com.example.neo4j_example_1.model");
    }

    @Bean
    public org.neo4j.ogm.config.Configuration configuration() {
        org.neo4j.ogm.config.Configuration configuration = new org.neo4j.ogm.config.Configuration.Builder()
                .uri("bolt://localhost:11005") 
                .credentials("neo4j", "neo4j")
                .autoIndex("none")
                .build();
        return configuration;
    }

    @Bean
    public Neo4jTransactionManager transactionManager() {
        return new Neo4jTransactionManager(sessionFactory());
    }

}

I'd like to start my database from Spring application without having to launch Neo4J Desktop before. Is that possible? I coudn't find a solution anywhere

1 REPLY 1

jggomez
Graph Voyager

Hi, I think that it is not possible. You must start neo4j before.

Thanks