-
Notifications
You must be signed in to change notification settings - Fork 25
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
PostConstruct
method Direct Injection
#752
Conversation
Why? What is the use case where this makes sense to do? |
Well, we already accept a bean scope as a parameter, this just eases the process of using the existing feature. |
But to answer you directly, a use case could be to send an event to any |
Not quite in that the Builder isn't the same thing as the BeanScope. The BeanScope is the immutable collection of beans in the scope, and the Builder is expected to be lived for the duration of building the scope. That is, the side effect of this change is that there are lifecycle methods that register that keep a reference to the Builder. |
No? builder.addPostConstruct(b -> $bean.prepareThyself(b.get(Serpent.class,"!serpent"), b.get(TYPE_ConsumerString), b));
We see this is the actual beanscope here avaje-inject/inject/src/main/java/io/avaje/inject/spi/DBeanScope.java Lines 246 to 248 in fa79dda
|
Ah cool !! |
generates the lookup and fetches beans for
PostConstruct
lifecycle methods. (Before we could only inject theBeanScope
)Given:
the following is generated: