-
-
Notifications
You must be signed in to change notification settings - Fork 202
Description
Today, Guice objects that implements the org.jooby.Managed interface and/or objects that are annotated with PostConstruct/PreDestroy annotations are automatically discovered and invoked at application startup or shutdown time.
In the next release we are going to remove that from Jooby and replace it by explicit calls to onStart/onStop/managed methods.
We need this to effectively apply start/stop callbacks in the order they were defined or added it. Unfortunately, this order can't be ensure by doing this via Guice. Actual implementation was more a hack than everything else.
You shouldn't worry or care about this change bc jooby internals (including all the available modules) will be updated to the new model. Except, of course if you implement a custom org.jooby.Managed object or use custom PostConstruct/PreDestroy annotated method. In case you do, then you must follow these instructions to upgrade to the new model:
- If you were binding
org.jooby.Managedguice objects then:
void configure(Env env, Config conf, Binder binder) {
env.managed(new MyManaged());
}- If you were binding
PostConstruct/PreDestroyguice objects then:
void configure(Env env, Config conf, Binder binder) {
env.managed(MyManaged.class);
}