Skip to content

Instantly share code, notes, and snippets.

@pk11
Created December 8, 2009 13:11
Show Gist options
  • Save pk11/251610 to your computer and use it in GitHub Desktop.
Save pk11/251610 to your computer and use it in GitHub Desktop.
//scala DI API
object MyContainer extends Container with GuiceSupport with ServletSupport{
configure(bind:BinderWrapper) {
val something = provide[Frog] {
if (Math.random() > .5) {
frogMan
} else weaselGirl
}
val onOff = bindTo[Heater]
val sensor = bindTo[Sensor]
val warmer = bindToSelf[Warmer]
bind[MyType] to [MyComponent]
serve("*.html") by[MyType]
filter("*.html") through[MyType]
}
}
val warmer = MyContainer.component[Warmer]
warmer.trigger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment