tags:

views:

122

answers:

2

Just thinking of implementing Guice in scala

Any sample code ?

+1  A: 

This post about DI in Scala will be able to help you to get going with Guice. See Using Google Guice topic.

Jaydeep
+6  A: 

Unless you specifically need Guice to add Scala to an existing Java-based project that uses framework, I'd advocate that you just use built-in language features instead.

Traits and implicits can give you all the Dependency Injection you'll need. You might also want to search online for the Cake pattern.

Kevin Wright
Exactly. While Guice is certainly a nice and clever solution for Java's problems with statics, singletons initialization etc, Scala just doesn't have these problems.
Landei
@Kevin - is there any equivalent to Guice's scopes when using the Cake pattern?
Ben Lings
@kevin @Landei Thank you, I will look into that.
Raj