Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin King committed Nov 13, 2009
1 parent c4d89e2 commit 89dcb00
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions reference/en-US/injection.xml
Expand Up @@ -498,11 +498,34 @@ public class MockPaymentProcessor implements PaymentProcessor {
</itemizedlist>

<para>
It's usually very easy to fix an unproxyable dependency problem. Simply add a constructor with no parameters to
the injected class, introduce an interface, or, if all else fails, change the scope of the injected bean to
<literal>@Dependent</literal>.
It's usually very easy to fix an unproxyable dependency problem. If an injection point of type
<literal>X</literal> results in an unproxyable dependency, simply:
</para>

<itemizedlist>
<listitem>
<para>
add a constructor with no parameters to <literal>X</literal>,
</para>
</listitem>
<listitem>
<para>
change the type of the injection point to <literal>Instance&lt;X&gt;</literal>,
</para>
</listitem>
<listitem>
<para>
introduce an interface <literal>Y</literal>, implemented by the injected bean, and change
the type of the injection point to <literal>Y</literal>, or
</para>
</listitem>
<listitem>
<para>
if all else fails, change the scope of the injected bean to <literal>@Dependent</literal>.
</para>
</listitem>
</itemizedlist>

<note>
<para>
A future release of Weld will likely support a non-standard workaround for this limitation, using
Expand Down

0 comments on commit 89dcb00

Please sign in to comment.