-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Recently I found myself writing some code that needed to leverage StartupStep
, and found the explicit end()
call to result in some painful handling. While I could (and in hindsight probably should) create a PR without an issue to do this, figured it would be better to check if the following change to StartupStep
would be welcome.
public interface StartupStep extends AutoCloseable {
// Note, all the other methods have been removed for brevity, only the changes are shown.
void end();
@Override
default void close() throws Exception {
this.end();
}
}
This would let the following code work,
public void customPostProcessing(SomeBeanInstance bean, ApplicationStartup startup) {
try(var step = startup.start(bean.getName())) {
step.tag("myTag", "myValue");
dostuff(bean);
} catch (CustomException ce) { ... }
}
Where before if you wanted to call end()
and handle exceptions, you'd have to ensure the StartupStep's scope would work for that.
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement