Skip to content

Commit

Permalink
rely on auto config for Neo4j TransactionManager
Browse files Browse the repository at this point in the history
  • Loading branch information
mshima authored Feb 29, 2024
1 parent 127bc90 commit 88a5a8e
Showing 1 changed file with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,15 @@

package <%= packageName %>.config;

import org.neo4j.driver.Driver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
<%_ if (searchEngineElasticsearch) { _%>
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.data.elasticsearch.repository.config.Enable<% if (reactive) { %>Reactive<% } %>ElasticsearchRepositories;
import org.springframework.data.neo4j.repository.<% if (reactive) { %>Reactive<% } %>Neo4jRepository;
<%_ } _%>
import org.springframework.data.neo4j.core.<% if (reactive) { %>Reactive<% } %>DatabaseSelectionProvider;

import org.springframework.data.neo4j.core.transaction.<% if (reactive) { %>Reactive<% } %>Neo4jTransactionManager;
import org.springframework.data.neo4j.repository.config.Enable<% if (reactive) { %>Reactive<% } %>Neo4jRepositories;
import org.springframework.data.neo4j.repository.config.<% if (reactive) { %>Reactive<% } %>Neo4jRepositoryConfigurationExtension;

<%_ if (searchEngineElasticsearch) { _%>
import org.springframework.data.neo4j.repository.<% if (reactive) { %>Reactive<% } %>Neo4jRepository;
<%_ } _%>
import org.springframework.transaction.<% if (reactive) { %>Reactive<% } %>TransactionManager;

@Configuration
<%_ if (searchEngineElasticsearch) { _%>
Expand All @@ -47,10 +38,4 @@ import org.springframework.transaction.<% if (reactive) { %>Reactive<% } %>Trans
<%_ if (searchEngineElasticsearch) { _%>
@Enable<% if (reactive) { %>Reactive<% } %>ElasticsearchRepositories("<%= packageName %>.repository.search")
<%_ } _%>
public class DatabaseConfiguration {

@Bean(<% if (reactive) { %>Reactive<% } %>Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
public <% if (reactive) { %>Reactive<% } %>TransactionManager transactionManager(Driver driver, <% if (reactive) { %>Reactive<% } %>DatabaseSelectionProvider databaseNameProvider) {
return new <% if (reactive) { %>Reactive<% } %>Neo4jTransactionManager(driver, databaseNameProvider);
}
}
public class DatabaseConfiguration {}

0 comments on commit 88a5a8e

Please sign in to comment.