Rephrased: a portable extension's observer methods must have a minimum of one parameter (the event being observed) and a maximum of two parameters (that plus the BeanManager), and none other if you want to stay truly portable.
For true container lifecycle events, I understand this (you don't have beans to inject yet). But given that a bean must be provided by the container for a portable extension (
http://docs.jboss.org/cdi/spec/2.0-PFD/cdi-spec.html#init_events), wouldn't it be reasonable to permit extra injection points in a portable extension's
non-container-lifecycle-event-observing observer methods?
Concretely, I'd like to do this:
// In my portable extension
private static final void doSomethingAtStartup(@Observes @Initialized(ApplicationScoped.class) final Object event, final Frobnicator someBean) {
someBean.doSomething();
}
...but that would seem to be in violation of the specification. Could someone kindly explain why?
Thanks,
Best,
Laird