google / google/guice

strange issue with different imports from javax and google guice

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

Description

I have noticed that when i use

@com.google.inject.Singleton

on a Class, it will be somehow inject a different instance than when i do the javax import of it.

So Class1 has the google Singleton import and has: "@Inject Class3". Class 3 would be "instance1"
and Class2 has the javax Singleton import and has: "@Inject Class3". Class 3 would be "instance2"

Maybe it is intentional but from what i saw in several docs, it should inject the same thing. (yes it is singleton). Same result when i call a method on both classes and use 3x "injector.getInstance(Class3.class), it would return the singleton but would somehow create one instance per javax and one per google import

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.