私はスカラプログラムであるakka-httpを実行しようとしています。次のように私のKISSコードは次のとおりです。 -違法継承、スーパークラスXはmixinの特性のスーパークラスYのサブクラスではありませんZ - Scala
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.{HttpRequest, HttpResponse}
import akka.http.scaladsl.server.Directives._
import akka.http.scaladsl.server.directives.BasicDirectives
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Flow
import com.typesafe.config.ConfigFactory
object MyBoot02 extends SprayCanBoot02 with RestInterface02 with App {
}
abstract class SprayCanBoot02 {
val config = ConfigFactory.load()
val host = config.getString("http.host")
val port = config.getInt("http.port")
implicit val system = ActorSystem("My-ActorSystem")
implicit val executionContext = system.dispatcher
implicit val materializer = ActorMaterializer()
//implicit val timeout = Timeout(10 seconds)
implicit val routes: Flow[HttpRequest, HttpResponse, Any]
Http().bindAndHandle(routes, host, port) map {
binding => println(s"The binding local address is ${binding.localAddress}")
}
}
trait RestInterface02 extends AncileDemoGateway02 with Resource02 {
implicit val routes = questionroutes
val buildMetadataConfig = "this is a build metadata route"
}
trait Resource02 extends QuestionResource02
trait QuestionResource02 {
val questionroutes = {
path("hi") {
get {
complete("questionairre created")
}
}
}
}
class AncileDemoGateway02 {
println("Whatever")
}
MyBoot02を実行しようとしたとき、私は得るためにどのように私は配線午前ものであるエラー。以下のようにエラーがある:
Error:(58, 41) illegal inheritance; superclass SprayCanBoot is not a subclass of the superclass AncileDemoGateway of the mixin trait RestInterface object MyBoot extends SprayCanBoot with RestInterface with App
はなぜエラー状態「SprayCanBootは、スーパークラスのサブクラスではないAncileDemoGateway」ん。私のコードでは、SprayCanBootとAncileDemoGatewayは2つの別個のエンティティであり、そのようなエラーはなぜですか?一般に
あなたはあなたの答えへの参照を提供できますか?私はそれがここの問題だとは思わない。ありがとう – BigDataScholar
'MyBoot02'のスーパークラスは' SprayCanBoot02'で、 'RestInterface02'のスーパークラスは' AncileDemoGateway02'です。 'SprayCanBoot02'は' AncileDemoGateway02'のサブクラスではないので、コンパイルされません。 – Sebastian