Skip to content

Clotho Internals : ClothoStarter

David Tran edited this page May 24, 2017 · 2 revisions

This is the file you run in order to startup the entire application.

Using Guice, ClothoStarter instantiates a static Injector object that also creates three modules in the background:

  • ClothoModule (reads config file, finds and provides SSL Keystore)
  • SecurityModule (Shiro, Authentication & Authorization, etc.)
  • JongoModule (binds certain interfaces to JongoConnection class where access to MongoDB is handled)

It's a very simple, but Guice abstracts a lot of the instantiation process away from the user so for those unfamiliar with dependency injection there's a lot of "what's happening now?" when trying to follow the code. The injector will take instantiated objects like the Persistor and insert them where needed as needed. If I was writing another class or module that needed to use some of the methods available to access the MongoDB database, I could get an instance of the Persistor from the Injector and freely use it as needed.

Clone this wiki locally