Injection with heritage and CDI

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Injection with heritage and CDI

Otávio Gonçalves de Santana-2

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 {

class DefaultSportCar implements SportCar {

What I would like to inject:

private Car car; //inject DefaultCar

private Car ferrari; //inject DefaultSportCar

private SportCar sportCar;//inject DefaultSportCar

How can I do that?

Otávio Gonçalves de Santana

cdi-dev mailing list
[hidden email]

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 ( For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.