Home / Function/ analyze() — spring-boot Function Reference

analyze() — spring-boot Function Reference

Architecture documentation for the analyze() function in NoUniqueBeanDefinitionFailureAnalyzer.java from the spring-boot codebase.

Entity Profile

Dependency Diagram

graph TD
  3df422c5_cdc3_9671_7776_7e4952f177af["analyze()"]
  5e1460be_beb5_eaef_c4c1_fddb3f2082cb["extractBeanNames()"]
  3df422c5_cdc3_9671_7776_7e4952f177af -->|calls| 5e1460be_beb5_eaef_c4c1_fddb3f2082cb
  5c757507_32c3_1482_5460_c193773ad77b["buildMessage()"]
  3df422c5_cdc3_9671_7776_7e4952f177af -->|calls| 5c757507_32c3_1482_5460_c193773ad77b
  1c0a452a_a003_0ab7_8926_72358d1266ed["FailureAnalysis()"]
  3df422c5_cdc3_9671_7776_7e4952f177af -->|calls| 1c0a452a_a003_0ab7_8926_72358d1266ed
  style 3df422c5_cdc3_9671_7776_7e4952f177af fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot/src/main/java/org/springframework/boot/diagnostics/analyzer/NoUniqueBeanDefinitionFailureAnalyzer.java lines 46–65

	@Override
	protected @Nullable FailureAnalysis analyze(Throwable rootFailure, NoUniqueBeanDefinitionException cause,
			@Nullable String description) {
		String[] beanNames = extractBeanNames(cause);
		if (beanNames == null) {
			return null;
		}
		StringBuilder message = new StringBuilder();
		message.append(String.format("%s required a single bean, but %d were found:%n",
				(description != null) ? description : "A component", beanNames.length));
		for (String beanName : beanNames) {
			buildMessage(message, beanName);
		}
		MissingParameterNamesFailureAnalyzer.appendPossibility(message);
		StringBuilder action = new StringBuilder(
				"Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, "
						+ "or using @Qualifier to identify the bean that should be consumed");
		action.append("%n%n%s".formatted(MissingParameterNamesFailureAnalyzer.ACTION));
		return new FailureAnalysis(message.toString(), action.toString(), cause);
	}

Domain

Subdomains

Calls

Frequently Asked Questions

What does analyze() do?
analyze() is a function in the spring-boot codebase.
What does analyze() call?
analyze() calls 3 function(s): FailureAnalysis, buildMessage, extractBeanNames.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free