google / google/guice

Documentation: clarify that there is no lifecycle support

Open
#1,069 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

Hi,
after using Guice for a few weeks, to my surprise today I discovered that Guice has no support for fundamental lifecycle callbacks like @PostConstruct, and there is no intention to add it https://github.com/google/guice/issues/62#issuecomment-115452493

As @PostConstruct is a critical feature when you do field/set injection (no constructor injection), I am now in the situation to be forced to switch to another DI framework (likely Spring or CDI Weld), as Guice's workarounds are far too verbose or error prone (eg, InjectionListener or constructor injection).

It would be great if the documentation of Guice could be updated to clearly state that @PostConstructor is and will not be supported, eg a section called "No Lifecycle Support" under https://github.com/google/guice/wiki/Bindings

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.