Fix @AutoConfigureTestDatabase imports
Update `@AutoConfigureTestDatabase` so that it always imports `DataSourceAutoConfiguration`. Prior to this commit the annotation could only be applied if something else also imported DataSource auto-configuration. Fixes gh-6897
This commit is contained in:
@@ -39,7 +39,8 @@ org.springframework.boot.test.autoconfigure.restdocs.RestDocsAutoConfiguration
|
||||
|
||||
# AutoConfigureTestDatabase auto-configuration imports
|
||||
org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestDatabase=\
|
||||
org.springframework.boot.test.autoconfigure.orm.jpa.TestDatabaseAutoConfiguration
|
||||
org.springframework.boot.test.autoconfigure.orm.jpa.TestDatabaseAutoConfiguration,\
|
||||
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
|
||||
|
||||
# AutoConfigureTestEntityManager auto-configuration imports
|
||||
org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestEntityManager=\
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
package org.springframework.boot.test.autoconfigure.orm.jpa;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
@@ -42,6 +44,7 @@ public class AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests {
|
||||
public void testContextLoades() throws Exception {
|
||||
// gh-6897
|
||||
assertThat(this.context).isNotNull();
|
||||
assertThat(this.context.getBeanNamesForType(DataSource.class)).isNotEmpty();
|
||||
}
|
||||
|
||||
@TestConfiguration
|
||||
|
||||
Reference in New Issue
Block a user