Lifecycle support
See original GitHub issueFrom hani@formicary.net on March 14, 2007 09:22:31
Support for JSR-250 (javax.annotation) would also be very useful for all those people using init() methods and the list.
The mapping I think is:
@
PostConstruct -> Called right after construction
@
Resource -> Analogous to @
Inject
@
PreDestroy -> No concept of destruction, is there?
@
Generated -> Doesn’t apply
_Original issue: http://code.google.com/p/google-guice/issues/detail?id=62_
Issue Analytics
- State:
- Created 9 years ago
- Comments:117 (1 by maintainers)
Top Results From Across the Web
Search Product and Services Lifecycle Information
Search below for a list of Microsoft commercial products and services and then select your result to find support and servicing timelines, required...
Read more >Lifecycle Support Services | Honeywell Intelligrated
Lifecycle Support Services can take complete ownership of lifecycle management via a contractual agreement designed to achieve your defined critical business ...
Read more >Overview - Product lifecycle - IBM Support
IBM's support lifecycle policy specifies how long support will be available for IBM products, from when the product is available for purchase to...
Read more >Support Life Cycle Policy - Check Point Software
Check Point's Enterprise Support Lifecycle policies outline the product support guidelines for a product's lifecycle.
Read more >Product Support Lifecycle | Micro Focus
AAI versions 1, 2, 4, 5 Extended 30 Nov 2010
Access Governance 7 Extended 30 Apr 2020
Access Manager 4 Committed 31 Jul 2023
Access Manager...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We have no plans of implementing lifecycle support.
You can use Guava’s
Service
+ServiceManager
(https://github.com/google/guava/wiki/ServiceExplained) to have services with a lifecycle. The simplest way is to bind a multiset ofSet<Service>
and construct aServiceManager
with that set.For things where you want to do something after creation/injection (otherwise known as provisioning), you can use a
ProvisionListener
(http://google.github.io/guice/api-docs/latest/javadoc/index.html?com/google/inject/spi/ProvisionListener.html, bound withBinder.bindListener
).Guice has no concept of “finishing” a scope or object, so anything where you want to do something on-destroy must be done through a separate framework that’s better suited to lifecycle management.
From crazyboblee on March 15, 2007 14:03:26
I’m inclined to lean on garbage collection for finalization logic. Or to delegate responsibility to something like OSGi.
We really need an external post-injection/pre-scoping hook. Then you could do whatever you want in a generic fashion:
Maybe something like this:
interface ProviderInterceptor<T> { T intercept(Key<T> key, Provider<T> next); }
Then you could apply them like this:
void bindInterceptor(Matcher<Key<…>> keyMatcher, ProviderInterceptor<…> interceptor);