[cdi-dev] Feedback - CDI bootstrap API (CDI-26)

John D. Ament john.d.ament at gmail.com
Wed Feb 11 12:02:21 EST 2015


Jozef,

Most of what you see there is taken from the original doc, since everyone
seemed to be in agreement.  I think the map is just a safeguard in case of
additional boot options available in some implementations (e.g. I think
OWB/OpenEJB have some options.. currently OpenEJB supports an embedded CDI
boot mode).

We spoke a few times about BeanManager vs CDI.  BeanManager was preferable
since there's no easy way to get the the instance, CDI is easier to get and
more aligned with how you would get it.  Usually people expect the
BeanManager to be injected or available via JNDI, neither would be the case
here.

Yes, this is the container start API.  Sounds like you have some good ideas
for things like XML configuration or programmatic configuration, both of
which are being tracked under separate tickets.  One idea might be for an
optional param in the map to control packages to scan/ignore, in that map.

We didn't want to over load the CDI interface.  It already does a lot.
This is really SPI code, CDI even though it's in the spi package is used in
a lot of application code.

John

On Wed Feb 11 2015 at 4:21:50 AM Jozef Hartinger <jharting at redhat.com>
wrote:

>  Hi John, some thoughts:
>
> - instead of using BeanManager it makes more sense to me to return a CDI
> instance, which is a more user-friendly API (and it also exposes access to
> BeanManager)
> - is there a usecase for arbitrary keys of the "params" map or is
> Map<String, ?> sufficient?
> - if we could move the shutdown() method from CDIContainer to the actual
> container handle that we obtain from initialize(), that would look more
> object-oriented
> - what exactly is initialize() supposed to do? Is it supposed to start
> scanning the entire classpath for CDI beans? That could be a problem
> especially with spring-boot-like fat jars. I think we need an API to tell
> the container which classes / packages to consider. Something like Guice's
> binding API perhaps?
>
> - the proposal makes me wonder whether retrofitting this functionality to
> the CDI class wouldn't be a better option. It could look like:
>
> CDI container = CDI.initialize();
> container.select(Foo.class).get();
> container.shutdown();
>
> compare it to:
>
> CDIContainer container = CDIContainerLoader. getCDIContainer();
> BeanManager manager = container.initialize();
> manager.getBeans(...);
> container.shutdown(manager);
>
>
> On 02/10/2015 06:58 PM, John D. Ament wrote:
>
> All,
>
>  I have the updated API here, and wanted to solicit any final feedback
> before updating the google doc and spec pages.
>
>
> https://github.com/johnament/cdi/commit/2c362161e18dd521f8e83c27151ddad467a1c01c
>
>  Let me know your thoughts.
>
>  Thanks,
>
>  John
>
>
> _______________________________________________
> cdi-dev mailing listcdi-dev at lists.jboss.orghttps://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/20150211/f57ba79d/attachment.html 


More information about the cdi-dev mailing list