@ApplicationScoped
public class CdiTest {
public static void main(String[] args)
{
Weld weld = new Weld();
WeldContainer container = weld.initialize();
CdiTest test = container.instance().select(CdiTest.class).get();
test.test();
}
public void test() {
}
@Produces
private ABeanToBeMocked aMockedBean = new ABeanToBeMocked(2);
@Inject
private ABeanToBeInjected aBeanToBeInjected;
public static class AProducer {
@Inject
private ABeanToBeMocked aMockedBean;
@Produces
public ABean namedBean()
{
return new ABean(2);
}
}
public static class ABeanToBeMocked {
ABeanToBeMocked(int foo) {
}
}
public static class ABeanToBeInjected
{
@Inject
ABean namedBean;
}
public static class ABean {
ABean(int foo) {
}
}
}