Spring beans are not injected in flyway java based migration

前端 未结 4 1435
迷失自我
迷失自我 2020-12-08 22:13

I\'m trying to inject component of configuration properties in the flyway migration java code but it always null.

I\'m using spring boot with Flyway.



        
4条回答
  •  失恋的感觉
    2020-12-08 22:55

    In short do not autowire beans in your db migrations or even reference classes from your application! If you refactor/delete/change classes you referenced in the migration it may not even compile or worse corrupt your migrations.

    The overhead of using plain JDBC template for the migrations is not worth the risk.

提交回复
热议问题