|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2022 the original author or authors. |
|
|
|
|
* Copyright 2012-2023 the original author or authors. |
|
|
|
|
* |
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
|
@ -94,6 +94,7 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
@@ -94,6 +94,7 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private BeanCreationException createFailure(Class<?> consumer) { |
|
|
|
|
this.context.registerBean("beanOne", TestBean.class); |
|
|
|
|
this.context.register(DuplicateBeansProducer.class, consumer); |
|
|
|
|
this.context.setParent(new AnnotationConfigApplicationContext(ParentProducer.class)); |
|
|
|
|
try { |
|
|
|
|
@ -110,8 +111,7 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
@@ -110,8 +111,7 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void assertFoundBeans(FailureAnalysis analysis) { |
|
|
|
|
assertThat(analysis.getDescription()) |
|
|
|
|
.contains("beanOne: defined by method 'beanOne' in " + DuplicateBeansProducer.class.getName()); |
|
|
|
|
assertThat(analysis.getDescription()).contains("beanOne: defined in unknown location"); |
|
|
|
|
assertThat(analysis.getDescription()) |
|
|
|
|
.contains("beanTwo: defined by method 'beanTwo' in " + DuplicateBeansProducer.class.getName()); |
|
|
|
|
assertThat(analysis.getDescription()) |
|
|
|
|
@ -126,11 +126,6 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
@@ -126,11 +126,6 @@ class NoUniqueBeanDefinitionFailureAnalyzerTests {
|
|
|
|
|
@ImportResource("/org/springframework/boot/diagnostics/analyzer/nounique/producer.xml") |
|
|
|
|
static class DuplicateBeansProducer { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
TestBean beanOne() { |
|
|
|
|
return new TestBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
TestBean beanTwo() { |
|
|
|
|
return new TestBean(); |
|
|
|
|
|