Skip to content

Missing Neo4jTransactionManager after migrated from Spring Boot 2.7.3 to 3.0.1 #33859

@luan-cestari-trustly

Description

@luan-cestari-trustly

Hi,

We moved from Spring Boot 2.7.3 to 3.0.1 and we also using Spring Data. After that, we noticed the Neo4jTransactionManager was missing, so any configuration like transaction timeout, was not working anymore

We made the follow code as workaround to solve the problem:

import org.neo4j.driver.Driver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.neo4j.core.DatabaseSelectionProvider;
import org.springframework.data.neo4j.core.transaction.Neo4jBookmarkManager;
import org.springframework.data.neo4j.core.transaction.Neo4jTransactionManager;
import org.springframework.data.neo4j.repository.config.Neo4jRepositoryConfigurationExtension;

import java.util.Objects;

@Configuration
@SuppressWarnings("unused")
public class Neo4jTransactionConfiguration {

    @ConditionalOnMissingBean(name = Neo4jRepositoryConfigurationExtension.DEFAULT_TRANSACTION_MANAGER_BEAN_NAME)
    @Bean(name = "transactionManager")
    public Neo4jTransactionManager neo4jTransactionManager(@Autowired Driver driver,
                                                           @Autowired DatabaseSelectionProvider databaseSelectionProvider,
                                                           @Autowired(required = false) Neo4jBookmarkManager neo4jBookmarkManager) {
        return new Neo4jTransactionManager(driver, databaseSelectionProvider,
                                           Objects.requireNonNullElseGet(neo4jBookmarkManager, Neo4jBookmarkManager::create));
    }
}

I opened this Issue to share the problem and help people with this workaround until this got fixed

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions