Areas of use:
Areas allow you to control the life cycle of an object.
You can only bindScope() annotate the scope. The scope concept is the injector level: wiring configuration.
You can associate several things (keys) in scope.
You can define as many areas as you want, but each snap can only be in one area.
You did not provide detailed information about your problem, but, in my experience, in most cases, when the user area is seen as correct at first, it is rarely really!
Perhaps you want to annotate two instances of the same type? Sort of:
bind(SomeService.class).in(First.class).to(FirstServiceImpl.class); bind(SomeService.class).in(Second.class).to(SecondServiceImpl.class);
Then you can enter the one you want:
@Inject SomeConstructor(@First SomeService service) { }
or
@Inject SomeConstructor(@Second SomeService service) { }
If this does not help, you may need to provide more detailed information about your problem.
source share