Hi, Spring Team. This is chickenchickenlove, huge fan of you all.
I suggest adding a new Hooking point.
How about adding a new Hooking Point between SmartLifeCycle#start()
and @PostConstruct
?
Sometimes, IMHO, it could be useful at times.
It would be great if it could be used in a similar convention to ApplicationEvent
and @EventListener
.
@EventListener(BeforeSmartLifeCycleStart.class)
public void doSomething(){
...
}
Thanks for reading this. 🙇♂️
Comment From: quaff
Please describe your actual use case.
Comment From: snicoll
Sometimes, IMHO, it could be useful at times.
Thanks for the suggestion but, without at least one concrete example, this issue is not actionable I am afraid. Before we consider adding an extra API to the core framework, we need to understand what's lacking with what we have and how we could improve it.
Comment From: artembilan
I think SmartInitializingSingleton.afterSingletonsInstantiated()
is the way to go for this use-case.
This way all the beans have called their afterPropertiesSet()
and no SmartLifeCycle.start()
called yet.
Comment From: snicoll
That was one callback I had in mind indeed, but we can't know for sure until @chickenchickenlove shares why they're asking for another hook point.
Comment From: artembilan
In my feeling, according to the related Spring for Apache Kafka PR, the solution lays indeed in the afterSingletonsInstantiated()
.
And this request was done because @chickenchickenlove had not been aware about SmartInitializingSingleton
.
Comment From: snicoll
OK I am trusting you have more context on that so let's close this.