mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Merge branch '2.2.x'
Closes gh-20503
This commit is contained in:
commit
4fd8f376dc
@ -180,11 +180,11 @@ public class DevToolsDataSourceAutoConfiguration {
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
ConditionMessage.Builder message = ConditionMessage.forCondition("DevTools DataSource Condition");
|
||||
String[] dataSourceBeanNames = context.getBeanFactory().getBeanNamesForType(DataSource.class);
|
||||
String[] dataSourceBeanNames = context.getBeanFactory().getBeanNamesForType(DataSource.class, true, false);
|
||||
if (dataSourceBeanNames.length != 1) {
|
||||
return ConditionOutcome.noMatch(message.didNotFind("a single DataSource bean").atAll());
|
||||
}
|
||||
if (context.getBeanFactory().getBeanNamesForType(DataSourceProperties.class).length != 1) {
|
||||
if (context.getBeanFactory().getBeanNamesForType(DataSourceProperties.class, true, false).length != 1) {
|
||||
return ConditionOutcome.noMatch(message.didNotFind("a single DataSourceProperties bean").atAll());
|
||||
}
|
||||
BeanDefinition dataSourceDefinition = context.getRegistry().getBeanDefinition(dataSourceBeanNames[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user