Hello everyone,
Is there a way to eagerly initialize a service? without calling Bean.get(Service.class)
I’ve tried the following code, but it does not work:
public class SomeModule extends AxelorModule {
@Override
protected void configure() {
bind(Service.class).to(ServiceImpl.class).asEagerSingleton();
}
}
ServiceImpl class have only a constructor which passes variables of another bean which is injected.
public class ServiceImpl implements Service {
@Inject
public ServiceImpl(SomeService someService) {
someService.addValidStatus(0); // Adds an int to Set<Integer> variable
someService.addBlockedName("Some name"); // Adds a string to a List<String> variable
}
}
It is also acceptable to call Beans.get(Service.class), but I do not know where I can call it safely.