public class PersistenceExceptionTranslationPostProcessor
extends org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor
Repository
annotation, adding a corresponding PersistenceExceptionTranslationAdvisor to
the exposed proxy (either an existing AOP proxy or a newly generated proxy that
implements all of the target's interfaces).
Translates native resource exceptions to Spring's
DataAccessException hierarchy.
Autodetects beans that implement the
PersistenceExceptionTranslator interface, which are subsequently asked to translate
candidate exceptions.
All of Spring's applicable resource factories (e.g.
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)
implement the PersistenceExceptionTranslator interface out of the box.
As a consequence, all that is usually needed to enable automatic exception
translation is marking all affected beans (such as Repositories or DAOs)
with the @Repository annotation, along with defining this post-processor
as a bean in the application context.
PersistenceExceptionTranslationAdvisor,
Repository,
DataAccessException,
PersistenceExceptionTranslator,
Serialized Form| Constructor and Description |
|---|
PersistenceExceptionTranslationPostProcessor() |
| Modifier and Type | Method and Description |
|---|---|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setRepositoryAnnotationType(java.lang.Class<? extends java.lang.annotation.Annotation> repositoryAnnotationType)
Set the 'repository' annotation type.
|
prepareProxyFactorycustomizeProxyFactory, isEligible, isEligible, postProcessAfterInitialization, postProcessBeforeInitialization, setBeforeExistingAdvisorsevaluateProxyInterfaces, getOrder, getProxyClassLoader, isConfigurationCallbackInterface, isInternalLanguageInterface, setBeanClassLoader, setOrder, setProxyClassLoaderpublic PersistenceExceptionTranslationPostProcessor()
public void setRepositoryAnnotationType(java.lang.Class<? extends java.lang.annotation.Annotation> repositoryAnnotationType)
Repository annotation.
This setter property exists so that developers can provide their own (non-Spring-specific) annotation type to indicate that a class has a repository role.
repositoryAnnotationType - the desired annotation typepublic void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwaresetBeanFactory in class org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor