public class Spincast extends Object
Will create the final Guice Injector and return
it when the init() method is called.
In addition to the methods directly provided by this
bootstrapper, it is possible to tweak the resulting Guice
context by using the GuiceTweaker class. The main
use case where a tweaker may be useful, is to write
test classes : the tweaker allows you to reuse the
exact same code that bootstraps your application
(often by calling its main(...) method), but
to tweak some bindings, mock some components.
| Constructor and Description |
|---|
Spincast() |
| Modifier and Type | Method and Description |
|---|---|
static SpincastBootstrapper |
configure()
Starts the bootsrapping of a Spincast application, using the
default plugins.
|
static com.google.inject.Module |
getDefaultModule()
Returns a module combining all the default
plugins implementations, parametrized with the
default Request and Websocket contextes.
|
static com.google.inject.Module |
getDefaultModule(boolean includeCoreModule)
Returns a module combining all the default
plugins implementations, parametrized with the
default Request and Websocket contextes.
|
static com.google.inject.Module |
getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass,
Class<? extends WebsocketContext<?>> websocketContextImplementationClass)
Returns a module combining all the default
plugins implementations.
|
static com.google.inject.Module |
getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass,
Class<? extends WebsocketContext<?>> websocketContextImplementationClass,
boolean includeCoreModule)
Returns a module combining all the default
plugins implementations.
|
static com.google.inject.Injector |
init(String[] args)
Initialize a default Spincast application.
|
public static SpincastBootstrapper configure()
When the configuration is done, call the init()
method to initialize the Guice context.
By default, the caller class is going to be bound in the Guice context.
If you want to disable this, call ".bindCallerClass(false)"!
public static com.google.inject.Injector init(String[] args)
The caller class is going to be bound in the Guice context.
You may want to add some kind of "@Inject init()"
method in it and start your application there!
The default Request Context type and the
default Websocket Context type will be used.
args - The parameters received in the main
method. Those will be bound in the Guice context and you will
be able to inject them wherever you need, using the
@MainArgs annotation.public static com.google.inject.Module getDefaultModule()
The SpincastCoreGuiceModule module is
included.
public static com.google.inject.Module getDefaultModule(boolean includeCoreModule)
The SpincastCoreGuiceModule module is not
included.
includeCoreModule - Should the Core module being
added too?public static com.google.inject.Module getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass)
The SpincastCoreGuiceModule module is not
included.
public static com.google.inject.Module getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass, boolean includeCoreModule)
The SpincastCoreGuiceModule module is not
included.
includeCoreModule - Should the Core module being
added too?Copyright © 2019. All rights reserved.