I have a java jersey 2.x project, using Guice as my dependency injection framework. I have this service
public class AccountService {
private final AccountRepository accountRepository;
@Inject
public AccountService(InMemoryAccountRepositoryImpl inMemoryAccountRepositoryImpl) {
this.accountRepository = inMemoryAccountRepositoryImpl;
}
Let's say that I create another service class that also injects InMemoryAccountRepositoryImpl
, will the same instance be injected? It's important for me to know, because this instance has an internal state that needs to be consistent.