-
Feature Request
-
Resolution: Done
-
Major
-
None
-
None
Proposal to add a method:
<U extends T> BeanBuilder<U> produceConstant(U instance);
This would be a shortcut so the common case when an existing instance whose lifecycle is not managed by CDI is exposed to CDI so instead of
Foo existing = getFoo(); builder.produceWith(() -> existing)
you can use
Foo existing = getFoo(); builder.produceConstant(existing)
The name is terrible and should really actually implement a better one. I can only think of:
produceConstant()
produceSingleton()
produceInstance()
produce()
at the moment but neither of them seems right so we should keep searching for a good one.