Skip to content

Call StartupStep.end in finally block #25572

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ else if (requiredType != null) {
markBeanAsCreated(beanName);
}

StartupStep beanCreation = this.applicationStartup.start("spring.beans.instantiate")
.tag("beanName", name);
try {
StartupStep beanCreation = this.applicationStartup.start("spring.beans.instantiate")
.tag("beanName", name);
if (requiredType != null) {
beanCreation.tag("beanType", requiredType::toString);
}
Expand Down Expand Up @@ -383,12 +383,16 @@ else if (mbd.isPrototype()) {
throw new ScopeNotActiveException(beanName, scopeName, ex);
}
}
beanCreation.end();
}
catch (BeansException ex) {
beanCreation.tag("exception", ex.getClass().toString());
beanCreation.tag("message", ex.getMessage());
cleanupAfterBeanCreationFailure(beanName);
throw ex;
}
finally {
beanCreation.end();
}
}

// Check if required type matches the type of the actual bean instance.
Expand Down