[cdi-dev] Proposal - Allow TransientReference to be used on producers.

John D. Ament john.d.ament at gmail.com
Tue May 3 20:15:43 EDT 2016


After some more thought, I'm re-negging on this approach.

The underlying problem has to do entirely with dependent scoped beans
within instance objects.  I've raised a PR making a more appropriate spec
change, clarifying more on the user side how they should work with them.

There's another section of the spec that I thought about adding this
content to, and wouldn't be opposed to making that change.

John

On Tue, May 3, 2016 at 1:20 PM John D. Ament <john.d.ament at gmail.com> wrote:

> All,
>
> I have opened a while ago - https://issues.jboss.org/browse/CDI-457 which
> was originally to add a disposable interface.  The main driver was that if
> you're using an injection point like
>
> @Inject
> private Instance<MyDependentBean> beanInst;
>
> doing beanInst.get() can cause leaking beans since there is no creational
> context.  Upon looking at it further, there's some effort to do this in a
> safer way and leverage things like TransientReference.
>
> This doesn't work for classes provided by external libraries, even the JDK
> itself (like String).  I'd like to propose that the scope of this ticket be
> to allow TransientReference on producer fields/methods since right now its
> only allowed on types.
>
> WDYT?
>
> John
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160504/530c0feb/attachment.html 


More information about the cdi-dev mailing list