Reintroduce factory method name in exception thrown from SimpleInstantiationStrategy

This commit is contained in:
Sam Brannen 2022-10-10 14:28:35 +02:00
parent 8227032a0f
commit 34e5aac0f5
1 changed files with 2 additions and 1 deletions

View File

@ -160,7 +160,8 @@ public class SimpleInstantiationStrategy implements InstantiationStrategy {
"Cannot access factory method '" + factoryMethod.getName() + "'; is it public?", ex); "Cannot access factory method '" + factoryMethod.getName() + "'; is it public?", ex);
} }
catch (InvocationTargetException ex) { catch (InvocationTargetException ex) {
String msg = ex.getTargetException().getMessage(); String msg = "Factory method '" + factoryMethod.getName() + "' threw exception with message: " +
ex.getTargetException().getMessage();
if (bd.getFactoryBeanName() != null && owner instanceof ConfigurableBeanFactory && if (bd.getFactoryBeanName() != null && owner instanceof ConfigurableBeanFactory &&
((ConfigurableBeanFactory) owner).isCurrentlyInCreation(bd.getFactoryBeanName())) { ((ConfigurableBeanFactory) owner).isCurrentlyInCreation(bd.getFactoryBeanName())) {
msg = "Circular reference involving containing bean '" + bd.getFactoryBeanName() + "' - consider " + msg = "Circular reference involving containing bean '" + bd.getFactoryBeanName() + "' - consider " +