Skip to content

Commit

Permalink
Merge branch '3.2.x'
Browse files Browse the repository at this point in the history
  • Loading branch information
mhalbritter committed Jun 12, 2024
2 parents 98018dd + fed13b0 commit 76e2009
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*/
@AutoConfiguration(before = TransactionAutoConfiguration.class,
after = TransactionManagerCustomizationAutoConfiguration.class)
@ConditionalOnClass({ JdbcTemplate.class, TransactionManager.class })
@ConditionalOnClass({ DataSource.class, JdbcTemplate.class, TransactionManager.class })
@AutoConfigureOrder(Ordered.LOWEST_PRECEDENCE)
@EnableConfigurationProperties(DataSourceProperties.class)
public class DataSourceTransactionManagerAutoConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.springframework.boot.autoconfigure.AutoConfigurations;
import org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration;
import org.springframework.boot.autoconfigure.transaction.TransactionManagerCustomizationAutoConfiguration;
import org.springframework.boot.test.context.FilteredClassLoader;
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.jdbc.support.JdbcTransactionManager;
Expand All @@ -40,6 +41,7 @@
* @author Stephane Nicoll
* @author Kazuki Shimizu
* @author Davin Byeon
* @author Moritz Halbritter
*/
class DataSourceTransactionManagerAutoConfigurationTests {

Expand Down Expand Up @@ -124,4 +126,10 @@ void transactionWithMultipleDataSourcesAndPrimaryCandidateIsConfigured() {
});
}

@Test
void shouldNotUseDataSourcePropertiesIfDataSourceIsNotOnTheClasspath() {
this.contextRunner.withClassLoader(new FilteredClassLoader(DataSource.class))
.run((context) -> assertThat(context).doesNotHaveBean(DataSourceProperties.class));
}

}

0 comments on commit 76e2009

Please sign in to comment.