[cdi-dev] Injection with heritage and CDI

Romain Manni-Bucau rmannibucau at gmail.com
Sat Jul 8 10:36:38 EDT 2017

Hi Otavio

Not sure it firts cdi-dev bit you can @Default @Ferrari
@Typed(SportCar.class) the nice red car to exclude it from Car type and
keep Car injection using DefaultCar and SportCar using the ferrari or
implicit default qualifier.

But the sample sounds like a misusage of qualifier so maybe check it is
really what you and to do.

Le 8 juil. 2017 16:27, "Otávio Gonçalves de Santana" <
otaviopolianasantana at gmail.com> a écrit :

Hey, I have a question about heritage and CDI.
Given two interfaces:

   - Car interface
   - SportCar that extends Car

interface Car{}
interface SportCar extends Car{}

class DefaultCar implements Car {}

@FerrariQualifierclass DefaultSportCar implements SportCar {}

What I would like to inject:

@Injectprivate Car car; //inject DefaultCar

@FerrariQualifierprivate Car ferrari; //inject DefaultSportCar

@Injectprivate SportCar sportCar;//inject DefaultSportCar

How can I do that?

Otávio Gonçalves de Santana

twitter: http://twitter.com/otaviojava
site:     *http://about.me/otaviojava <http://about.me/otaviojava>*

cdi-dev mailing list
cdi-dev at lists.jboss.org

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/20170708/58a5d5c1/attachment.html 

More information about the cdi-dev mailing list