File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 4141import org .springframework .context .annotation .AnnotationConfigApplicationContext ;
4242import org .springframework .context .annotation .Bean ;
4343import org .springframework .context .annotation .Configuration ;
44+ import org .springframework .context .annotation .Primary ;
4445import org .springframework .core .Ordered ;
4546import org .springframework .core .env .MapPropertySource ;
4647import org .springframework .orm .jpa .LocalContainerEntityManagerFactoryBean ;
@@ -101,7 +102,8 @@ public void flywayDataSource() throws Exception {
101102 EmbeddedDataSourceConfiguration .class , FlywayAutoConfiguration .class ,
102103 PropertyPlaceholderAutoConfiguration .class );
103104 Flyway flyway = this .context .getBean (Flyway .class );
104- assertThat (flyway .getDataSource ()).isNotNull ();
105+ assertThat (flyway .getDataSource ())
106+ .isEqualTo (this .context .getBean ("flywayDataSource" ));
105107 }
106108
107109 @ Test
@@ -241,6 +243,13 @@ private void registerAndRefresh(Class<?>... annotatedClasses) {
241243 @ Configuration
242244 protected static class FlywayDataSourceConfiguration {
243245
246+ @ Bean
247+ @ Primary
248+ public DataSource normalDataSource () {
249+ return DataSourceBuilder .create ().url ("jdbc:hsqldb:mem:normal" ).username ("sa" )
250+ .build ();
251+ }
252+
244253 @ FlywayDataSource
245254 @ Bean
246255 public DataSource flywayDataSource () {
You can’t perform that action at this time.
0 commit comments