Skip to content

Instantly share code, notes, and snippets.

@xerial
Last active July 16, 2018 00:14
Show Gist options
  • Save xerial/f08ebac82a8cc018a260efad0330bbf5 to your computer and use it in GitHub Desktop.
Save xerial/f08ebac82a8cc018a260efad0330bbf5 to your computer and use it in GitHub Desktop.
import wvlet.airframe._
// Read configurations from a YAML file
val yaml = readConfig("config.yml")
// Configure Application
val d = newDesign
.bind[ServiceConfig].toInstance(new ServiceConfig(yaml.get(...), yaml.get(..))
.bind[WebAppConfig].toInstance(new WebAppConfig(...))
// Initialize Services
d.build[WebApp]{ webApp =>
// new WebApp(session.get[WebAppConfig], session.get[WebComponent]) will be called
// new WebComponent(session.get[Service]) will be called
// new Service(session.get[ServiceConfig]) will be called
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment