use of org.springframework.beans.factory.BeanCreationException in project spring-boot by spring-projects.
the class HikariDriverConfigurationFailureAnalyzerTests method performAnalysis.
private FailureAnalysis performAnalysis(Class<?> configuration) {
BeanCreationException failure = createFailure(configuration);
assertThat(failure).isNotNull();
return new HikariDriverConfigurationFailureAnalyzer().analyze(failure);
}
use of org.springframework.beans.factory.BeanCreationException in project spring-boot by spring-projects.
the class HikariDriverConfigurationFailureAnalyzerTests method createFailure.
private BeanCreationException createFailure(Class<?> configuration) {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.datasource.type=" + HikariDataSource.class.getName(), "spring.datasource.hikari.data-source-class-name=com.example.Foo", "spring.sql.init.mode=always").applyTo(context);
context.register(configuration);
try {
context.refresh();
context.close();
return null;
} catch (BeanCreationException ex) {
return ex;
}
}
use of org.springframework.beans.factory.BeanCreationException in project spring-boot by spring-projects.
the class BindValidationFailureAnalyzerTests method createFailure.
private BeanCreationException createFailure(Class<?> configuration, String... environment) {
try {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
addEnvironment(context, environment);
context.register(configuration);
context.refresh();
context.close();
return null;
} catch (BeanCreationException ex) {
return ex;
}
}
use of org.springframework.beans.factory.BeanCreationException in project spring-boot by spring-projects.
the class InvalidConfigurationPropertyNameFailureAnalyzerTests method createFailure.
private BeanCreationException createFailure(Class<?> configuration) {
try {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.register(configuration);
context.refresh();
context.close();
return null;
} catch (BeanCreationException ex) {
return ex;
}
}
use of org.springframework.beans.factory.BeanCreationException in project spring-boot by spring-projects.
the class InvalidConfigurationPropertyNameFailureAnalyzer method analyze.
@Override
protected FailureAnalysis analyze(Throwable rootFailure, InvalidConfigurationPropertyNameException cause) {
BeanCreationException exception = findCause(rootFailure, BeanCreationException.class);
String action = String.format("Modify '%s' so that it conforms to the canonical names requirements.", cause.getName());
return new FailureAnalysis(buildDescription(cause, exception), action, cause);
}
Aggregations