Commit 2c621f40 authored by Phillip Webb's avatar Phillip Webb

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
parent 825dd0a2
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment