google / google/guice

singletions recreated many times on error, memebrs injected values may be null

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

Description

_From [kvaster](https://code.google.com/u/104372103509061941353/) on December 25, 2011 05:39:32_

1) Singletons should be not recreated many times if there was error whil constructing it. i.e.:
class T1, class T2 depends on T1 and class T3 depends on T1.
All of them singletons. Guice will try to create T1 three times: when creating itself, when creating T2 and T3.

2) Injected member may be null in case of dependent bean creation error. i.e.:
T1 class, T2 class have member of T1.
T1 failed to create due to exception, but T2 will not fail, rather it will have T1 fieled equal to null.

Attached patch to fix issues.

**Attachment:** [gist](https://gist.github.com/7aec64883fdaef09aafc)
   _[guice-singleton-recreation.patch](https://gist.githubusercontent.com/gissuebot/7aec64883fdaef09aafc/raw/cbaef7d71c98d15ad2001937223161562f0b2611/guice-singleton-recreation.patch)_

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=676_

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.