Search in sources :

Example 1 with EventListener

use of org.neo4j.ogm.session.event.EventListener in project spring-boot by spring-projects.

the class Neo4jDataAutoConfiguration method sessionFactory.

@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration, ApplicationContext applicationContext, ObjectProvider<List<EventListener>> eventListeners) {
    SessionFactory sessionFactory = new SessionFactory(configuration, getPackagesToScan(applicationContext));
    List<EventListener> providedEventListeners = eventListeners.getIfAvailable();
    if (providedEventListeners != null) {
        for (EventListener eventListener : providedEventListeners) {
            sessionFactory.register(eventListener);
        }
    }
    return sessionFactory;
}
Also used : SessionFactory(org.neo4j.ogm.session.SessionFactory) EventListener(org.neo4j.ogm.session.event.EventListener) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

SessionFactory (org.neo4j.ogm.session.SessionFactory)1 EventListener (org.neo4j.ogm.session.event.EventListener)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1