For the future reference:

One can inject using

       @Inject Instance<MyBean> bean;

and then call

       bean.isUnsatisfied()

This wouldn't throw an exception and allow to check before use.

Ondra


On 03/05/2013 12:59 AM, Igor Vaynberg wrote:
this is how cdi works, if it cannot inject something it fails. notice
the top frame is inside weld not wicket nor wicket-cdi.

if you have things that can be optional you should inject
Instance<Thing> and query that for thing.

-igor

On Mon, Mar 4, 2013 at 1:25 PM, Ondrej Zizka <[email protected]> wrote:
Hi all,

I use the CDI integration.

    new
CdiConfiguration(bm).setPropagation(ConversationPropagation.NONE).configure(this);

When the injection fails, it happens in <init>. Can I configure it to set
the field to null,  as a NPE during page rendering is easier to handle than
init exception?
I didn't find anything in the lib itself.

The stacktrace is:

      at
org.jboss.weld.manager.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:102)
      at net.ftlines.wicket.cdi.NonContextual.inject(NonContextual.java:141)
      at
net.ftlines.wicket.cdi.NonContextualManager.inject(NonContextualManager.java:49)
      at
net.ftlines.wicket.cdi.AbstractInjector.inject(AbstractInjector.java:38)
      at
net.ftlines.wicket.cdi.ComponentInjector.onInstantiation(ComponentInjector.java:43)
      at
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:36)
      at
org.apache.wicket.application.ComponentInstantiationListenerCollection$1.notify(ComponentInstantiationListenerCollection.java:34)
      at
org.apache.wicket.util.listener.ListenerCollection.notify(ListenerCollection.java:80)
      at
org.apache.wicket.application.ComponentInstantiationListenerCollection.onInstantiation(ComponentInstantiationListenerCollection.java:32)
      at org.apache.wicket.Component.<init>(Component.java:679)


Thanks,
Ondra

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to