Affects: 5.2.x

For bugs ,I found an invalid code from DefaultSingletonBeanRegistry#getSingleton(String, ObjectFactory<?>). There is a problem with exception handling in the above method. I need a screenshot to show this.

Spring Issue with suppressed exception handling in DefaultSingletonBeanRegistry#getSingleton(String,ObjectFactory)

This block of code will not be executed:

if (recordSuppressedExceptions) {
    for (Exception suppressedException : this.suppressedExceptions) {
        ex.addRelatedCause(suppressedException);
    }
}

As mentioned above, this is a minor problem that I discovered when I re-analyzed the Spring lifecycle source code.

Comment From: r331

Nice catch!

Comment From: snicoll

The boolean initialization works by making sure that the list is null. The list is fed by onSuppressedException. When you look at the code from top to bottom, it gives a feeling that the list is always empty but there is callback to the method above while the bean (or any of its dependency) is created.