use of org.flywaydb.core.api.migration.spring.SpringJdbcMigration in project flyway by flyway.
the class SpringJdbcMigrationResolver method resolveMigrations.
@Override
public Collection<ResolvedMigration> resolveMigrations() {
List<ResolvedMigration> migrations = new ArrayList<ResolvedMigration>();
if (!location.isClassPath()) {
return migrations;
}
try {
Class<?>[] classes = scanner.scanForClasses(location, SpringJdbcMigration.class);
for (Class<?> clazz : classes) {
SpringJdbcMigration springJdbcMigration = ClassUtils.instantiate(clazz.getName(), scanner.getClassLoader());
ConfigurationInjectionUtils.injectFlywayConfiguration(springJdbcMigration, configuration);
ResolvedMigrationImpl migrationInfo = extractMigrationInfo(springJdbcMigration);
migrationInfo.setPhysicalLocation(ClassUtils.getLocationOnDisk(clazz));
migrationInfo.setExecutor(new SpringJdbcMigrationExecutor(springJdbcMigration));
migrations.add(migrationInfo);
}
} catch (Exception e) {
throw new FlywayException("Unable to resolve Spring Jdbc Java migrations in location: " + location, e);
}
Collections.sort(migrations, new ResolvedMigrationComparator());
return migrations;
}
Aggregations