Calling a service on startup in a Play application
问题 I have a Play 2.4 application. Trying to kick off a weekly task when application starts. The current recommendation is to do that in a constructor for an eagerly injected class (Guice). However, my task needs access to a service. How can I inject that service into my task without getting an error: Error injecting constructor, java.lang.RuntimeException: There is no started application ? 回答1: You need to use constructor injection in your ApplicationStart class and provide an ApplicationModule