I sometimes make a new answer by using an already good answer and recode it in another language or a more recent version of Java:
Should I edit the accepted answer instead to keep the credit of the original creator?
Most recent example: The question with the answer of jbnizet in Kotlin:
Spring Boot 2.1.0 with Flyway 4.2.0
My answer in Java:
@Configuration
class FlywayConfig {
@Autowired
DataSource dataSource;
public FlywayConfig() {
super();
}
@Bean
Flyway flyway() {
Flyway flyway = null;
flyway = new Flyway();
flyway.setDataSource(dataSource);
flyway.setTable("POD_FLYWAY");
return flyway;
}
@Bean
FlywayMigrationInitializer flywayInitializer(Flyway flyway ) {
return new FlywayMigrationInitializer(flyway, null);
}
/**
* Additional configuration to ensure that [EntityManagerFactory] beans depend on the
* `flywayInitializer` bean.
*/
@Configuration
public static class FlywayInitializerJpaDependencyConfiguration extends EntityManagerFactoryDependsOnPostProcessor {
public FlywayInitializerJpaDependencyConfiguration() {
super("flywayInitializer");
}
}
}
My problem is that I basically did a copy-paste of that answer, but there is a value for the developer who don't know Kotlin.