public static interface Jooby.Module
routes
, Body.Parser
,
Body.Formatter
, request modules
and any other
application specific service or contract of your choice.
It is similar to Module
except for the callback method receives a
Env
, Config
and Binder
.
A module can provide his own set of properties through the config()
method. By
default, this method returns an empty config object.
use(new M1()); use(new M2()); use(new M3());Previous example had the following order (first-listed are higher priority):
A module can provide start/stop methods in order to start or close resources.
Jooby.use(Jooby.Module)
Modifier and Type | Method and Description |
---|---|
default com.typesafe.config.Config |
config() |
void |
configure(Env env,
com.typesafe.config.Config config,
com.google.inject.Binder binder)
Configure and produces bindings for the underlying application.
|
default void |
start()
Callback method to start a module.
|
default void |
stop()
Callback method to stop a module and clean any resources.
|
@Nonnull default com.typesafe.config.Config config()
default void start()
default void stop()
void configure(@Nonnull Env env, @Nonnull com.typesafe.config.Config config, @Nonnull com.google.inject.Binder binder)
application env
and/or the current
application properties available from Config
.env
- The current application's env. Not null.config
- The current config object. Not null.binder
- A guice binder. Not null.Copyright © 2015. All rights reserved.