Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Configuration
- public class AppConfig {
- @Bean(initMethod = "migrate")
- Flyway flyway() {
- Flyway flyway = new Flyway();
- flyway.setBaselineOnMigrate(true);
- flyway.setLocations("filesystem:/path/to/migrations/");
- flyway.setDataSource(dataSource());
- return flyway;
- }
- @Bean @DependsOn("flyway")
- EntityManagerFactory entityManagerFactory() {
- LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
- bean.setDataSource(dataSource());
- // other configurations
- return bean.getObject();
- }
- @Bean
- DataSource dataSource() {
- DataSource dataSource = new BasicDataSource();
- // data source configuration
- return dataSource;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement