-
Feature Request
-
Resolution: Done
-
Major
-
3.0.0.Alpha9
-
None
Currently, adding a couple of beans with the @Default qualifier requires more code than is IMHO necessary:
Weld builder = new Weld().disableDiscovery().addPackage(false, Main.class); builder.addBean().producing(conf.getEmailConfiguration()).addType(EmailConfiguration.class).addQualifier(DefaultLiteral.INSTANCE); builder.addBean().producing(conf).addType(MainConfiguration.class).addQualifier(DefaultLiteral.INSTANCE); builder.addBean().producing(client).addType(Client.class).addQualifier(DefaultLiteral.INSTANCE).scope(ApplicationScoped.class).disposeWith(c -> c.close()); builder.addBean().producing(executor).addType(ScheduledExecutorService.class).addQualifier(DefaultLiteral.INSTANCE); WeldContainer weld = builder.initialize();
Notice the .addQualifier(DefaultLiteral.INSTANCE) call being repeated for all the beans. The builder should instead handle this automatically.