I would like to inject a different implementation in a bean, depending on the context. Here is the situation :
interface A{}
class AImplForTest implements A{}
class AImplForProd implements A{}
class B{
@Inject A a;
}
In a test context, I would like the AImplForTest to be injected, while in a production context, this should be AImplForProd. B is the same class in the two contexts. Is it possible?
Never used in practice but from theory you could use the
@Alternativeannotation.From the Weld reference documentation: