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

analyze() — spring-boot Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  0926a6fc_c637_4052_331c_69508124c58c["analyze()"]
  bf6a10a3_acf4_7c70_137d_19f5c8444a1a["analyze()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| bf6a10a3_acf4_7c70_137d_19f5c8444a1a
  e48e5d6c_790e_67ae_b894_c5b0b733fdec["getAutoConfigurationResults()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| e48e5d6c_790e_67ae_b894_c5b0b733fdec
  6a8c7869_1853_72cd_5bd3_2cdc5cd6a863["getUserConfigurationResults()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| 6a8c7869_1853_72cd_5bd3_2cdc5cd6a863
  128dfd16_57e6_eee2_5e42_bfdd5585de3d["getBeanDescription()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| 128dfd16_57e6_eee2_5e42_bfdd5585de3d
  136d09e4_745c_fda0_30e7_3d05f0f34655["findInjectionPoint()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| 136d09e4_745c_fda0_30e7_3d05f0f34655
  1c0a452a_a003_0ab7_8926_72358d1266ed["FailureAnalysis()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| 1c0a452a_a003_0ab7_8926_72358d1266ed
  a1705267_70fe_d5bc_698f_2f245b558f9f["toString()"]
  0926a6fc_c637_4052_331c_69508124c58c -->|calls| a1705267_70fe_d5bc_698f_2f245b558f9f
  style 0926a6fc_c637_4052_331c_69508124c58c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

core/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/diagnostics/analyzer/NoSuchBeanDefinitionFailureAnalyzer.java lines 78–113

	@Override
	protected @Nullable FailureAnalysis analyze(Throwable rootFailure, NoSuchBeanDefinitionException cause,
			@Nullable String description) {
		if (cause.getNumberOfBeansFound() != 0) {
			return null;
		}
		List<AutoConfigurationResult> autoConfigurationResults = getAutoConfigurationResults(cause);
		List<UserConfigurationResult> userConfigurationResults = getUserConfigurationResults(cause);
		StringBuilder message = new StringBuilder();
		message.append(String.format("%s required %s that could not be found.%n",
				(description != null) ? description : "A component", getBeanDescription(cause)));
		InjectionPoint injectionPoint = findInjectionPoint(rootFailure);
		if (injectionPoint != null) {
			Annotation[] injectionAnnotations = injectionPoint.getAnnotations();
			if (injectionAnnotations.length > 0) {
				message.append(String.format("%nThe injection point has the following annotations:%n"));
				for (Annotation injectionAnnotation : injectionAnnotations) {
					message.append(String.format("\t- %s%n", injectionAnnotation));
				}
			}
		}
		if (!autoConfigurationResults.isEmpty() || !userConfigurationResults.isEmpty()) {
			message.append(String.format("%nThe following candidates were found but could not be injected:%n"));
			for (AutoConfigurationResult result : autoConfigurationResults) {
				message.append(String.format("\t- %s%n", result));
			}
			for (UserConfigurationResult result : userConfigurationResults) {
				message.append(String.format("\t- %s%n", result));
			}
		}
		String action = String.format("Consider %s %s in your configuration.",
				(!autoConfigurationResults.isEmpty() || !userConfigurationResults.isEmpty())
						? "revisiting the entries above or defining" : "defining",
				getBeanDescription(cause));
		return new FailureAnalysis(message.toString(), action, cause);
	}

Domain

Subdomains

Frequently Asked Questions

What does analyze() do?
analyze() is a function in the spring-boot codebase.
What does analyze() call?
analyze() calls 7 function(s): FailureAnalysis, analyze, findInjectionPoint, getAutoConfigurationResults, getBeanDescription, getUserConfigurationResults, toString.

Analyze Your Own Codebase

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

Try Supermodel Free