Class Spincast
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic SpincastBootstrapper
Starts the bootsrapping of a Spincast application, using the default plugins.static com.google.inject.Module
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
Initialize a default Spincast application.
-
Constructor Details
-
Spincast
public Spincast()
-
-
Method Details
-
configure
Starts the bootsrapping of a Spincast application, using the default plugins.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)"
!- Returns:
- The bootstrapper
-
init
Initialize a default Spincast application.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 defaultWebsocket Context
type will be used.- Parameters:
args
- The parameters received in themain
method. Those will be bound in the Guice context and you will be able to inject them wherever you need, using the@MainArgs
annotation.- Returns:
- The create Guice Injector (context).
-
getDefaultModule
public static com.google.inject.Module getDefaultModule()Returns a module combining all the default plugins implementations, parametrized with the default Request and Websocket contextes.The
SpincastCoreGuiceModule
module is included. -
getDefaultModule
public 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.The
SpincastCoreGuiceModule
module is not included.- Parameters:
includeCoreModule
- Should the Core module being added too?
-
getDefaultModule
public static com.google.inject.Module getDefaultModule(Class<? extends RequestContext<?>> requestContextImplementationClass, Class<? extends WebsocketContext<?>> websocketContextImplementationClass) Returns a module combining all the default plugins implementations.The
SpincastCoreGuiceModule
module is not included. -
getDefaultModule
public 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.The
SpincastCoreGuiceModule
module is not included.- Parameters:
includeCoreModule
- Should the Core module being added too?
-