Spring 1.4.1
Two DataSource beans, one marked as Primary.
When running a test using DataJpaTest, TestDatabaseAutoConfiguration will look for, and replace the DataSource bean that has been marked as primary with the created embedded database DataSource but does not then mark that replacement bean as primary. The issue looks to be in TestDatabaseAutoConfiguration .EmbeddedDataSourceBeanFactoryPostProcessor.process()