From 711fafc924e451b9b2eae63839280aff11f381cd Mon Sep 17 00:00:00 2001 From: Michael Simons Date: Thu, 6 Feb 2020 15:41:33 +0100 Subject: [PATCH] Improve assertion message in PersistenceExceptionTranslationInterceptor Closes gh-24484 --- .../support/PersistenceExceptionTranslationInterceptor.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java index 1c035451e9..7727874332 100644 --- a/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java +++ b/spring-tx/src/main/java/org/springframework/dao/support/PersistenceExceptionTranslationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2020 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. @@ -146,7 +146,7 @@ public class PersistenceExceptionTranslationInterceptor else { PersistenceExceptionTranslator translator = this.persistenceExceptionTranslator; if (translator == null) { - Assert.state(this.beanFactory != null, "No PersistenceExceptionTranslator set"); + Assert.state(this.beanFactory != null, "Cannot use PersistenceExceptionTranslator autodetection without ListableBeanFactory"); translator = detectPersistenceExceptionTranslators(this.beanFactory); this.persistenceExceptionTranslator = translator; }