I still struggle sometimes, coming from a spring framework mindset, figuring out how to do some stuff. Though I love the @Provides support in trunk of Guice. Here's hoping 2.0 is out soon! :)
I've experimented recently adding support for ConstructorInterceptors into guice so you can add custom lifecycles like @PostContruct from JSR250/EJB3 or Spring's InitializingBean etc.
I've also created a patch to support closing of singletons such as via @PreDestroy or spring's DisposableBean.
Slightly more wacky is a patch adding support for custom injection point annotations which allows you to easily support things like
- @Resource from JSR 250/EJB3
- @PersistenceContext from JPA
- the various JAX-RS annotations like @Context, @PathParam etc
- WebBeans @In
- Spring's @Autowire
- Apache Camel's injection annotations like @EndpointInject or @Produce
Feedback greatly appreciated!
Yayy!!!! I've been asking Bob for this for forever. Here's hoping it comes standard with Guice in the future and we seem some migration to it...
Do you think it would be possible then to have a module loaded in the camel:run instead of having to resort to spring?
Thats a great idea! I'll see what I can do...
Post a Comment