use of org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor in project spring-boot by spring-projects.
the class PersistenceExceptionTranslationAutoConfigurationTests method exceptionTranslationPostProcessorCanBeDisabled.
@Test
void exceptionTranslationPostProcessorCanBeDisabled() {
this.context = new AnnotationConfigApplicationContext();
TestPropertyValues.of("spring.dao.exceptiontranslation.enabled=false").applyTo(this.context);
this.context.register(PersistenceExceptionTranslationAutoConfiguration.class);
this.context.refresh();
Map<String, PersistenceExceptionTranslationPostProcessor> beans = this.context.getBeansOfType(PersistenceExceptionTranslationPostProcessor.class);
assertThat(beans).isEmpty();
}
use of org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor in project spring-boot by spring-projects.
the class PersistenceExceptionTranslationAutoConfigurationTests method exceptionTranslationPostProcessorUsesCglibByDefault.
@Test
void exceptionTranslationPostProcessorUsesCglibByDefault() {
this.context = new AnnotationConfigApplicationContext(PersistenceExceptionTranslationAutoConfiguration.class);
Map<String, PersistenceExceptionTranslationPostProcessor> beans = this.context.getBeansOfType(PersistenceExceptionTranslationPostProcessor.class);
assertThat(beans).hasSize(1);
assertThat(beans.values().iterator().next().isProxyTargetClass()).isTrue();
}
Aggregations