Skip to content

DataSourceInitializer accidental override because of bean name clash #1236

@wtatum

Description

@wtatum

Beginning in 1.1.3, the autoconfig report always includes the positive match:

DataSourceAutoConfiguration.DataSourceInitializerConfiguration
      - @ConditionalOnMissingBean (types: org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer; SearchStrategy: all) found no beans (OnBeanCondition)

Since this match is conditional on the spring boot DataSourceInitializer, it will still be created even if the non-boot type org.springframework.jdbc.datasource.init.DataSourceInitializer is present. This wouldn't appear to be a big deal. The DataSourceInitializer won't do anything unless the schema.sql or data.sql are present (if I understand correctly), but since the "natural" name for both beans is dataSourceInitializer and the autoconfig one is created early (possibly related to #1115?) my bean was not created.

Changing the name of my bean to any other name resolves the issue, but perhaps the @ConditionalOnMissingBean should refer to the spring-jdbc type and not the boot specific type?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions