|
|
|
|
@ -1,5 +1,5 @@
@@ -1,5 +1,5 @@
|
|
|
|
|
/* |
|
|
|
|
* Copyright 2012-2019 the original author or authors. |
|
|
|
|
* Copyright 2012-2021 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. |
|
|
|
|
@ -109,6 +109,19 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
@@ -109,6 +109,19 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
|
|
|
|
|
assertThat(lines.get(11)).isEqualTo("└─────┘"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void testSelfReferenceCycle() throws IOException { |
|
|
|
|
FailureAnalysis analysis = performAnalysis(SelfReferenceBeanConfiguration.class); |
|
|
|
|
List<String> lines = readDescriptionLines(analysis); |
|
|
|
|
assertThat(lines).hasSize(5); |
|
|
|
|
assertThat(lines.get(0)) |
|
|
|
|
.isEqualTo("The dependencies of some of the beans in the application context form a cycle:"); |
|
|
|
|
assertThat(lines.get(1)).isEqualTo(""); |
|
|
|
|
assertThat(lines.get(2)).isEqualTo("┌──->──┐"); |
|
|
|
|
assertThat(lines.get(3)).startsWith("| bean defined in " + SelfReferenceBeanConfiguration.class.getName()); |
|
|
|
|
assertThat(lines.get(4)).isEqualTo("└──<-──┘"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void cycleWithAnUnknownStartIsNotAnalyzed() { |
|
|
|
|
assertThat(this.analyzer.analyze(new BeanCurrentlyInCreationException("test"))).isNull(); |
|
|
|
|
@ -240,6 +253,16 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
@@ -240,6 +253,16 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
static class SelfReferenceBeanConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
SelfReferenceBean bean(SelfReferenceBean bean) { |
|
|
|
|
return new SelfReferenceBean(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static class RefererOne { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
@ -266,4 +289,11 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
@@ -266,4 +289,11 @@ class BeanCurrentlyInCreationFailureAnalyzerTests {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static class SelfReferenceBean { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
SelfReferenceBean bean; |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|