org.flywaydb.core.internal.resolver.spring.SpringJdbcMigrationResolverCustom Maven / Gradle / Ivy
package org.flywaydb.core.internal.resolver.spring;
import org.flywaydb.core.api.migration.spring.SpringJdbcMigration;
import org.flywaydb.core.internal.resolver.ResolvedMigrationImpl;
import org.flywaydb.core.internal.util.Locations;
import org.flywaydb.core.internal.util.scanner.Scanner;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
public class SpringJdbcMigrationResolverCustom extends org.flywaydb.core.internal.resolver.spring.SpringJdbcMigrationResolver {
private final ApplicationContext applicationContext;
public SpringJdbcMigrationResolverCustom(Scanner scanner, Locations locations, org.flywaydb.core.api.configuration.FlywayConfiguration configuration, ApplicationContext applicationContext) {
super(scanner, locations, configuration);
this.applicationContext = applicationContext;
}
@Override
ResolvedMigrationImpl extractMigrationInfo(SpringJdbcMigration springJdbcMigration) {
if (springJdbcMigration instanceof ApplicationContextAware) {
((ApplicationContextAware) springJdbcMigration).setApplicationContext(this.applicationContext);
}
return super.extractMigrationInfo(springJdbcMigration);
}
}