Documentation: clarify that there is no lifecycle support

Open Beginner friendly
#1,069 3 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
65/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
documentation

Research direction

Open the Guice wiki Bindings page referenced in the issue and review its existing lifecycle-related content. Add a clear statement that Guice does not support @PostConstruct or lifecycle callbacks and that this is not planned; the documentation should explicitly communicate the limitation.

Written by the indexing model from the issue text.

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

Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from google/guice

All issues in google/guice

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.