[cdi-dev] New builders API

arjan tijms arjan.tijms at gmail.com
Sat Apr 23 11:47:57 EDT 2016


Interesting research really.

If you'd like to have another example case, both Mojarra (JSF) and Soteria
(Security) use a lot of dynamic bean building.

See e.g.




We were already eying the CDI 2.0 BeanBuilder API, but for the meantime
have been using our own (less general) version.

Kind regards,
Arjan Tijms

On Sat, Apr 23, 2016 at 12:56 PM, John D. Ament <john.d.ament at gmail.com>

> Hey guys
> Based on the last f2f I was in, I took an action item to look at how
> applications can leverage the new builder methods/classes from this PR:
> https://github.com/cdi-spec/cdi/pull/287
> To do this, I took some existing OSS CDI extensions and converted parts to
> use the new APIs instead of the old ones.
> The results were iffy to be honest.  Here's some of the key issues I
> noticed:
> - AfterBeanDiscovery#addBean - vs AfterBeanDiscovery.addBean(Bean<?> bean)
> In the latter, it's clearer to a developer which attributes are required
> vs optional.  Builders typically use sensible defaults.  Maybe that was the
> intention here, but I couldn't really get that sense when converting over.
> It also wasn't clear what to do when done.  I suspect I just leave it, but
> without some kind of closing "build()" or "done()" method, it becomes
> ambiguous.
> - Annotated*Configurator
> TBH, I have no idea what I was configuring in this one at the first pass.
> I started with a method.  I wanted to replace the method's annotations.  It
> seemed like I could set that up using the configurator, but I ended up
> having to do setAnnotated at the end anyways, so I'm not sure what the
> configurator bought me.
> The one nice thing I saw was the simpler to use lambda functions.  Being
> able to stream through things like annotated method made the code much
> cleaner.
> For the open source code, I'll try to get some gists together that show
> the changes.  Maybe there's something I'm missing, so wouldn't mind a
> second set of eyes on the changes to see.
> John
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> Note that for all code provided on this list, the provider licenses the
> code under the Apache License, Version 2 (
> http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas
> provided on this list, the provider waives all patent and other
> intellectual property rights inherent in such information.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160423/6182387e/attachment-0001.html 

More information about the cdi-dev mailing list