Merge branch '6.1.x'
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2023 the original author or authors.
|
||||
* Copyright 2002-2024 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import org.aopalliance.intercept.MethodInterceptor;
|
||||
import org.aopalliance.intercept.MethodInvocation;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanCreationNotAllowedException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
@@ -146,7 +147,14 @@ public class PersistenceExceptionTranslationInterceptor
|
||||
if (translator == null) {
|
||||
Assert.state(this.beanFactory != null,
|
||||
"Cannot use PersistenceExceptionTranslator autodetection without ListableBeanFactory");
|
||||
translator = detectPersistenceExceptionTranslators(this.beanFactory);
|
||||
try {
|
||||
translator = detectPersistenceExceptionTranslators(this.beanFactory);
|
||||
}
|
||||
catch (BeanCreationNotAllowedException ex2) {
|
||||
// Cannot create PersistenceExceptionTranslator bean on shutdown:
|
||||
// fall back to rethrowing original exception without translation
|
||||
throw ex;
|
||||
}
|
||||
this.persistenceExceptionTranslator = translator;
|
||||
}
|
||||
throw DataAccessUtils.translateIfNecessary(ex, translator);
|
||||
|
||||
Reference in New Issue
Block a user