lundi 20 avril 2015

Execute sth. after or before bean is created

I use spring-boot with flyway and a datasource, so both beans are automatically configured by spring-boot. Now I would like to execute sth. either directly after the datasource or before the flyway bean is initialized.

How can I configure externally -preferably with annotations- that flyway dependsOn mySth or that post construct of the datasource sth should be called?

Is it the 'better' approach trying to alter the bean initialization order or registering an ApplicationListener (if possible)?

Aucun commentaire:

Enregistrer un commentaire