나는이 있습니다 프로젝트) :스칼라 케이크 패턴과 멀티 프로젝트
object MyOtherApp {
trait MyOtherTableName extends DBTableNamesProvider
val MyCustomService = MyService() with MyOtherTableName // will not compile how to reuse the module's MyService() with another implementation of one of the traits?
}
가 위의 난 그냥이면 MyService() 건설을 호출하고 의존성의 일부를 재정의 할 수 없습니다 컴파일되지 않습니다.
위의 내용은 MyProjectATableNames의 자체 구현과 함께 적용되는 MyService()의 공장 구성이 다른 프로젝트에서 재정의하려는 경우 스칼라에서 가능합니까? 코드 반복없이 권장되는 방법은 무엇입니까?
'MyService'는 특성이며, 그것을 익명으로 좋아하는 경향이 있습니다. 또한, Play를 좋아하는 두 블로거의 의견을 제외하고는 케이크 패턴에 아무런 문제가 없습니다. – Dima