You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Component
classMigration: InitializingBean, ApplicationListener<ApplicationReadyEvent>{
@Value("\${spring.datasource.url}")
val dbUrl:String=""
@Value("\${spring.datasource.username}")
val dbUsername:String=""
@Value("\${spring.datasource.password}")
val dbPassword:String=""
@Autowired
lateinitvar migrationConfig:MigrationConfigProperties
@Autowired
protectedvar context:ApplicationContext?=nulloverridefunafterPropertiesSet() {
if (migrationConfig.isEnable) {
Migrate(dbUrl, dbUsername, dbPassword).run(migrationConfig.isDryRun)
}
}
overridefunonApplicationEvent(event:ApplicationReadyEvent) {
Migrate(dbUrl, dbUsername, dbPassword).runCode(context, migrationConfig.isDryRun)
}
}
classM2018_03_15_105104_test_migration: CodeMigration<ApplicationContext> {
overridefunrun(context:ApplicationContext) {
// context.getBean("xxx")// do what every you want
}
}