use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class RedisUrlSyntaxFailureAnalyzerTests method analyzeRedisSocketUrl.
@Test
void analyzeRedisSocketUrl() {
RedisUrlSyntaxException exception = new RedisUrlSyntaxException("redis-socket:///redis/redis.sock");
FailureAnalysis analysis = new RedisUrlSyntaxFailureAnalyzer().analyze(exception);
assertThat(analysis.getDescription()).contains("The URL 'redis-socket:///redis/redis.sock' is not valid").contains("The scheme 'redis-socket' is not supported");
assertThat(analysis.getAction()).contains("Configure the appropriate Spring Data Redis connection beans");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class IncompatibleConfigurationFailureAnalyzerTests method incompatibleConfigurationListsKeys.
@Test
void incompatibleConfigurationListsKeys() {
FailureAnalysis failureAnalysis = performAnalysis("spring.first.key", "spring.second.key");
assertThat(failureAnalysis.getDescription()).contains("The following configuration properties have incompatible values: [spring.first.key, spring.second.key]");
assertThat(failureAnalysis.getAction()).contains("Review the docs for spring.first.key, spring.second.key and change the configured values.");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NotConstructorBoundInjectionFailureAnalyzer method analyze.
@Override
protected FailureAnalysis analyze(Throwable rootFailure, NoSuchBeanDefinitionException cause, String description) {
InjectionPoint injectionPoint = findInjectionPoint(rootFailure);
if (isConstructorBindingConfigurationProperties(injectionPoint)) {
String simpleName = injectionPoint.getMember().getDeclaringClass().getSimpleName();
String action = String.format("Update your configuration so that " + simpleName + " is defined via @" + ConfigurationPropertiesScan.class.getSimpleName() + " or @" + EnableConfigurationProperties.class.getSimpleName() + ".", simpleName);
return new FailureAnalysis(simpleName + " is annotated with @" + ConstructorBinding.class.getSimpleName() + " but it is defined as a regular bean which caused dependency injection to fail.", action, cause);
}
return null;
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class ConnectionFactoryBeanCreationFailureAnalyzerTests method failureAnalysisIsPerformed.
@Test
void failureAnalysisIsPerformed() {
FailureAnalysis failureAnalysis = performAnalysis(TestConfiguration.class);
assertThat(failureAnalysis.getDescription()).contains("'url' attribute is not specified", "no embedded database could be configured");
assertThat(failureAnalysis.getAction()).contains("If you want an embedded database (H2), please put it on the classpath", "If you have database settings to be loaded from a particular profile you may need to activate it", "(no profiles are currently active)");
}
use of org.springframework.boot.diagnostics.FailureAnalysis in project spring-boot by spring-projects.
the class NonUniqueSessionRepositoryFailureAnalyzerTests method failureAnalysisWithMultipleCandidates.
@Test
void failureAnalysisWithMultipleCandidates() {
FailureAnalysis analysis = analyzeFailure(createFailure(JdbcIndexedSessionRepository.class, HazelcastIndexedSessionRepository.class));
assertThat(analysis).isNotNull();
assertThat(analysis.getDescription()).contains(JdbcIndexedSessionRepository.class.getName(), HazelcastIndexedSessionRepository.class.getName());
assertThat(analysis.getAction()).contains("spring.session.store-type");
}
Aggregations