Skip to content

Non-default DataSource candidates are not considered in H2ConsoleAutoConfiguration #44293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @author Marten Deinum
* @author Stephane Nicoll
* @author Phillip Webb
* @author Yanming Zhou
* @since 1.3.0
*/
@AutoConfiguration(after = DataSourceAutoConfiguration.class)
Expand Down Expand Up @@ -113,7 +114,10 @@ private void withThreadContextClassLoader(ClassLoader classLoader, Runnable acti
}

private List<String> getConnectionUrls(ObjectProvider<DataSource> dataSources) {
return dataSources.orderedStream().map(this::getConnectionUrl).filter(Objects::nonNull).toList();
return dataSources.orderedStream(ObjectProvider.UNFILTERED)
.map(this::getConnectionUrl)
.filter(Objects::nonNull)
.toList();
}

private String getConnectionUrl(DataSource dataSource) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
* @author Stephane Nicoll
* @author Shraddha Yeole
* @author Phillip Webb
* @author Yanming Zhou
*/
class H2ConsoleAutoConfigurationTests {

Expand Down Expand Up @@ -206,7 +207,7 @@ DataSource anotherDataSource() throws SQLException {
return mockDataSource("anotherJdbcUrl");
}

@Bean
@Bean(defaultCandidate = false)
@Order(0)
DataSource someDataSource() throws SQLException {
return mockDataSource("someJdbcUrl");
Expand Down