@Test @DisplayName("transactionManagerのBeanが定義されている") public void transactionManagerTest() { Method transactionManagerMethod = assertDoesNotThrow(() -> ServiceConfig.class.getMethod("transactionManager", DataSource.class)); Bean bean = transactionManagerMethod.getAnnotation(Bean.class); assertNotNull(bean, "annotation required"); PlatformTransactionManager transactionManager = serviceConfig.transactionManager(dataSourceConfig.dataSource()); assertTrue(transactionManager instanceof DataSourceTransactionManager, "not correct transaction manager"); }
@Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); }
ServiceConfig { @Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); } }
ServiceConfig { @Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); }  }
ServiceConfig { @Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); }  @Bean PlatformTransactionManager transactionManager(DataSource dataSource); }
ServiceConfig { @Bean public PlatformTransactionManager transactionManager(DataSource dataSource) { return new DataSourceTransactionManager(dataSource); }  @Bean PlatformTransactionManager transactionManager(DataSource dataSource);  }