ãä¹ ãã¶ãã§ãã Scala ã§DIã£ã½ããã¨ãããæ¹æ³ã¨ç³ãã¾ãã¨ããããã£ãã¢ããã¼ããããã®ã§ããã ããã ã¨ãinjectç¨ã®Traitãå±±ã®ããã«å®ç¾©ããªãã¨ãããªãã¦ãç ©éãªæ°ãããã®ã§ãèªåã§ç°¡åãªDIã®ä»çµã¿ãä½ã£ã¦ã¿ã¾ããã ãããªæãã§ãâ 1 import scala.collection.immutable.Map 2 3 trait Key[+T] 4 5 class Component(entries:Map[Key[Any],()=>Any]) { 6 7     def define[T](key:Key[T], instance: => T) = 8         new Component(entries + (key -> (()=>instance))) 9 10     def apply[T](key:Key[T]):T = 11      Â
{{#tags}}- {{label}}
{{/tags}}