Can a Module provide custom routes?

Hello there,

We have a multi-module project that we would like to extend with modules. The idea is to add some modules to the classpath and activate them via play.modules.enabled I made some successful tests.
But I would like to allow those modules to extends the router and, sadly, I cannot find anything about that. I saw in this discussion[1] that the sird router should be the best option however I don’t see how to dynamically add routes to the default router (routes.conf) ?

So, can a Module provide custom routes during the binding ?

Thanks

[1] https://groups.google.com/d/msg/play-framework/u0tOgHg9bAI/SJpSD0D3AwAJ

At this time, I am able to use a custom router (declared in application.conf\play.http.router). This router query the Guice Injector to resolve all routers (bounds by the modules).

But I have some issue with the Router#withPrefix(String):Router method that I don’t really understand. Actually I return this but it seems that this cause the exception:

RuntimeException: The global application reference is disabled. Play’s global state is deprecated and will be removed in a future release. You should use dependency injection instead. To enable the global application anyway, set play.allowGlobalApplication = true.

Edit:
By providing a custom router (it seems that) I was able to achieve it.
I can add modules with routers that uses the “sird” and disable them by removing them from the classpath.
However I still have the exception above when a module route “is not matched”:

case GET(p"/greet") => ctrl.module()
case _ => Action {
   Results.NotFound(s"No route matched in MyModule (/module/*)")
}

The default case is executed and I get the error message shown above.
Here is my sample project: https://github.com/gervaisb/play-scala-modular