# Reactive + Spring Boot + Neo4j + SDN Multiple DB - Unable to detect customized driver configuration

**URL:** <https://community.neo4j.com/t/reactive-spring-boot-neo4j-sdn-multiple-db-unable-to-detect-customized-driver-configuration/56813>\
**Category:** Drivers & Stacks\
**Tags:** neo4j-driver, java-api, java-driver, neo4j\
**Created:** [May 25, 2022, 6:16pm UTC](https://community.neo4j.com/t/reactive-spring-boot-neo4j-sdn-multiple-db-unable-to-detect-customized-driver-configuration/56813 "2022-05-25T18:16:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrasoumya100](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/patrasoumya100/32/21585_2.png) [@patrasoumya100](https://community.neo4j.com/u/patrasoumya100)\
**Post date:** [May 25, 2022, 6:16pm UTC](https://community.neo4j.com/t/reactive-spring-boot-neo4j-sdn-multiple-db-unable-to-detect-customized-driver-configuration/56813/1 "2022-05-25T18:16:56Z")

</div>

We are trying to configure two different neo4j db instance of same URI in reactive spring boot application. We have configured **two different configuration** as well. **One of the configuration** mentioned below but it's not detecting the configuration rather it's only considered what database mentioned in application.yml file i.e. **spring.data.neo4j.database**. If we don't mentioned this in yml file then it's inserting into default neo4j db. Although we have hardcoded the db in configuration file but it's not picking that.

```auto
application.yml

spring:
  application:
  neo4j:
    repositories:
      type: reactive
    uri: bolt://localhost:11003/
    authentication:
      password: Test
      username: neo4j
  data:
    neo4j:
      database: ocean

inland:
  spring:
    neo4j:
      repositories:
        type: reactive
      uri: bolt://localhost:11003/
      authentication:
        password: Test
        username: neo4j
    data:
      neo4j:
        database: oceans

@Configuration(proxyBeanMethods = false)
@EnableReactiveNeo4jRepositories(
        basePackageClasses = InlandNeo4jConfiguration.class,
        neo4jMappingContextRef = "inlandContext",
        transactionManagerRef = "inlandManager")

@Slf4j
public class InlandNeo4jConfiguration {

    @Bean
    public Driver inlandDriver(@Qualifier("inlandProperties") Neo4jProperties inlandProperties) {
        var authentication = inlandProperties.getAuthentication();
        return GraphDatabase.driver(inlandProperties.getUri(), AuthTokens.basic(
                authentication.getUsername(), authentication
                        .getPassword()),
                Config.builder()
                        .withMaxConnectionLifetime(3, TimeUnit.MINUTES)
                        .build());
    }

    @Bean
    public ReactiveDatabaseSelectionProvider inlandSelection(
            @Qualifier("inlandDataProperties") Neo4jDataProperties inlandDataProperties) {
        log.info("Inland db {}", inlandDataProperties.getDatabase());
        return () -> Mono.just(DatabaseSelection.byName("inlandsurcharge"));
    }

    @Bean
    public ReactiveTransactionManager inlandManager(
            @Qualifier("inlandDriver") Driver driver,
            @Qualifier("inlandSelection") ReactiveDatabaseSelectionProvider inlandSelection) {
        return new ReactiveNeo4jTransactionManager(driver, inlandSelection);
    }

    @Bean
    public Neo4jMappingContext inlandContext(ResourceLoader resourceLoader, Neo4jConversions neo4jConversions)
            throws ClassNotFoundException {
        Neo4jMappingContext context = new Neo4jMappingContext(neo4jConversions);
        context.setInitialEntitySet(Neo4jEntityScanner.get(resourceLoader).scan(this.getClass().getPackageName()));
        return context;
    }

@Configuration(proxyBeanMethods = false)
@EnableReactiveNeo4jRepositories(
        basePackageClasses = OceanNeo4jConfiguration.class,
        neo4jMappingContextRef = "oceanContext",
        transactionManagerRef = "oceanManager")

@Slf4j
public class OceanNeo4jConfiguration {

    @Bean
    @Primary
    public Driver oceanDriver(Neo4jProperties oceanProperties) {
        var authentication = oceanProperties.getAuthentication();
        return GraphDatabase.driver(oceanProperties.getUri(), AuthTokens.basic(
                authentication.getUsername(), authentication
                        .getPassword()),
                Config.builder()
                        .withMaxConnectionLifetime(3, TimeUnit.MINUTES)
                        .build());
    }

    @Bean
    @Primary
    public ReactiveTransactionManager oceanManager(
            Driver driver,
            ReactiveDatabaseSelectionProvider oceanSelection) {
        return new ReactiveNeo4jTransactionManager(driver, oceanSelection);
    }

    @Bean
    @Primary
    public ReactiveDatabaseSelectionProvider oceanSelection(
            Neo4jDataProperties oceanDataProperties) {
        return () -> Mono.just(DatabaseSelection.byName("ocean"));
    }

    @Bean
    @Primary
    public Neo4jMappingContext oceanContext(ResourceLoader resourceLoader, Neo4jConversions neo4jConversions)
            throws ClassNotFoundException {
        Neo4jMappingContext context = new Neo4jMappingContext(neo4jConversions);
        context.setInitialEntitySet(Neo4jEntityScanner.get(resourceLoader).scan(this.getClass().getPackageName()));
        return context;
    }

```
