eclipse-sisu / sisu-project

Sisu Inject
https://www.eclipse.org/sisu
Eclipse Public License 2.0
17 stars 15 forks source link

Manage the lifecycle of components constructed using 'new' in a provider (Bugzilla Bug 467320) #25

Open mcculls opened 2 years ago

mcculls commented 2 years ago

This issue was created automatically with bugzilla2github

Bugzilla Bug 467320

Date: 2015-05-14 07:30:45 -0400 From: Stuart McCulloch <mcculls@gmail.com> To: Project Inbox <sisu-inbox@eclipse.org>

Last updated: 2015-05-14 07:30:45 -0400

Comment 2563401

Date: 2015-05-14 07:30:45 -0400 From: Stuart McCulloch <mcculls@gmail.com>

Currently any components constructed using 'new' in a provider are not managed by the LifecycleModule. This is because they are not covered by Guice's TypeListener, instead we need to use the ProvisionListener to detect them (though we need to be careful to avoid duplicates, since the same component could trigger multiple provision calls).

Note it is possible to tell the BeanManager about external instances:

   if (beanManager.manage(instance.getClass()) {
       beanManager.manage(instance);
   }

but this is a bit clunky and could be improved to be a single call.