Add @DependsOnDatabaseInitialization to Spring beans and components depending on javax.sql.DataSource

MSAL

Beans of certain well-known types, such as JdbcTemplate, will be ordered so that they are initialized after the database has been initialized. If you have a bean that works with the DataSource directly, annotate its class or @Bean method with @DependsOnDatabaseInitialization to ensure that it too is initialized after the database has been initialized. See the release notes for more.

org.openrewrite.java.spring.boot2.DatabaseComponentAndBeanInitializationOrdering
mod run . --recipe=org.openrewrite.java.spring.boot2.DatabaseComponentAndBeanInitializationOrdering

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Unconditionally add @DependsOnDatabaseInitialization to Spring beans and components depending on javax.sql.DataSource