micronaut

No bean of type [io.micronaut.jdbc.DataSourceResolver] exists


I updated micronaut from 3.7.* to 4.0.0 and since then application is failing to start with the below error:

Message: No bean of type [io.micronaut.jdbc.DataSourceResolver] exists. 
Path Taken: DatasourceFactory.dataSource(DatasourceConfiguration datasourceConfiguration) --> new RepairingDataSourceMigrationRunner(ApplicationContext applicationContext,ApplicationEventPublisher eventPublisher,[DataSourceResolver dataSourceResolver])
        at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1982)
        at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:294)
        at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3348)
        at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3692)
        at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:342)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:202)
        at io.micronaut.runtime.Micronaut.start(Micronaut.java:74)
        ... 2 more
Caused by: io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for parameter [dataSourceResolver] of class

I have this included n my gradle already:

implementation("io.micronaut.sql:micronaut-jdbc-hikari")
implementation("io.micronaut.sql:micronaut-jdbc")

I also have datasources listed in the application.yaml. I'm not getting what I'm missing here. Can someone please help on this?


Solution

  • I removed injecting DataSourceResolver as I found it deprecated in micronaut's updated release and that has fixed the issue.