hi rudy,

the producer for the message-context with the @Jsf qualifier creates a
dependent instance.
since the default implementation (without qualifier) doesn't specify a scope
(because it's independent of cdi), it's automatically a dependent bean.

that means: you can't use the startup event in this case, because you just
get a dependent bean.
you can create a custom producer which produces the context in the scope of
your choice.
(you can have a look at JsfAwareMessageContextProducer as an example.)

thx for the question! i'll add more information to the documentation.

regards,
gerhard

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces



2011/3/25 Rudy De Busscher <[email protected]>

> Hi all,
>
> I like to register a new MessageHandler in CODI but it gets never called.
>
> On the wiki page (1) I found a description how this could be done.  I
> placed the line of code within a method that observes for StartupEvent like
> this
>
>     @Inject
>     private MessageContext context;
>
>     public void configureErrorMessageListener(@Observes StartupEvent
> startupEvent) {
>         context.config().change().addMessageHandler(new
> ErrorMessageHandler());
>     }
>
> But the messageContext injected in the CDI Request bean does contain only
> the standard JSF aware message handler.
> Adding the @Jsf Qualifier is also not changing anything. (This i can
> understand because the method producer created a new config, and is not
> using the original one)
>
> My version is 0.9.4-SNAPSHOT
>
> Thx
> Rudy
>
> (1) https://cwiki.apache.org/confluence/display/EXTCDI/Message+DevDoc
>

Reply via email to