Prior to this commit it was possible that a StartupStep was started but never ended. This was the case when an exception occured during bean initializing. To always call the method regardless of the outcome, the call to StartupStep.end has been moved to a finally block.

When an exception occurs the StartupStep is also enriched with the exception class and message for diagnostic purposes.

Related: spring-projects/spring-boot#22776

Comment From: mdeinum

Maybe more events need to be in a try/finally approach due to possible errors being generated? I didn't investigate all other events (as this was the one that was missing).

Comment From: bclozel

Thanks @mdeinum , I totally missed that one; I'll take another look at other events.