hi can some one help with eager instantiation of singletons(after app starts but before request comes), I have gone through all the earlier discussions, and none of those worked.Things I have tried.
public class MetricRegistryModule extends AbstractModule {
public static final ALogger LOGGER = Logger.of(MetricRegistryModule.class);
protected void configure() {
bind(AppStartup.class).asEagerSingleton();
Logger.debug("here $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$");
}
}
package modules;
import play.Configuration;
import play.Environment;
import play.Logger;
import play.inject.ApplicationLifecycle;
import javax.inject.Inject;
import javax.inject.Singleton;
class AppStartup {
@Inject
public AppStartup(ApplicationLifecycle lifecycle) {
onStart();
}
public void onStart() {
Logger.debug("here #####################################################################################");
}
}
I also tried changing mode from dev to prod.
They did not work as well, can anyone help with this.