Source:How to use java.net.URLConnection to fire and handle HTTP requests
@Configuration
@EnableTransactionManagement // +++ added annotation
@EnableJpaRepositories(basePackages = "com.stackoverflow.my.project")
@PropertySource("application-tests.properties")
@ComponentScan({ "com.stackoverflow.my.project" })
public class H2JpaConfig {
@Bean
public PlatformTransactionManager transactionManager() {
final HibernateTransactionManager transactionManager = new HibernateTransactionManager();
transactionManager.setSessionFactory(sessionFactory().getObject());
return transactionManager;
}
}