How to aggregate akka-http routes using a trait?
<p>I am trying to aggregate routes using a trait at runtime, so far I have</p>

<pre><code>object SMController {
  def aggregateRoutes(actorSystem: ActorSystem): List[Route] = {
    val runtimeMirror = universe.runtimeMirror(getClass.getClassLoader)
    val reflections = new Reflections("com.example.api")
    val subclasses = reflections.getSubTypesOf(classOf[Routable])
    val routesList = new ListBuffer[Route]()

    for (i &lt;- subclasses) {
      val module = runtimeMirror.staticModule(i.getName)
      val obj = runtimeMirror.reflectModule(module)
      val someTrait: Routable = obj.instance.asInstanceOf[Routable]
      routesList += someTrait.getAllRoutes(actorSystem)
    }

    routesList.toList
  }
}
</code></pre>

<p>obviously above code doesn't work as the List of items cannot be passed to <code>Http().bindAndHandle</code>.</p>

<p>So my question is,  how can I parse the <code>List[Routes]</code> to a <code>Http().bindAndHandle</code> accepts or how can I dynamically load routes from subclasses of <code>Routable</code>?</p>