Get list of all routes in play 2.5 in SCALA with DI

72 views
Skip to first unread message

Ivan Sebben

unread,
Oct 21, 2016, 4:50:57 AM10/21/16
to Play Framework
Hi,

How can I retrive all routes of my play project? 
I try to inject in My controller the Router provider but have always thi problem:

CreationException: Unable to create injector, see the following errors: 1) Tried proxying services.ConfigUtils to support a circular dependency, but circular proxies are disabled. at Module.configure(Module.scala:14) (via modules: com.google.inject.util.Modules$OverrideModule -> Module) while locating services.ConfigUtils for parameter 0 at controllers.ApplicationController.<init>(ApplicationController.scala:16) at controllers.ApplicationController.class(ApplicationController.scala:16) while locating controllers.ApplicationController for parameter 3 at router.Routes.<init>(Routes.scala:35) while locating router.Routes while locating play.api.inject.RoutesProvider while locating play.api.routing.Router for parameter 0 at play.core.j.JavaRouterAdapter.<init>(JavaRouterAdapter.scala:17) while locating play.core.j.JavaRouterAdapter while locating play.routing.Router for parameter 2 at services.ConfigUtils.<init>(ConfigUtils.scala:30) at Module.configure(Module.scala:14) (via modules: com.google.inject.util.Modules$OverrideModule -> Module) while locating services.ConfigUtils


Greg Methvin

unread,
Oct 21, 2016, 4:58:44 AM10/21/16
to play-framework
Hi Ivan,

This is a classic circular dependency issue. The router needs your controllers, your controller needs ConfigUtils, and ConfigUtils needs the router. Hence the circular dependency. In this case you could try injecting a Provider<Router> to break the cycle, and just make sure you don't need to get the router until after ConfigUtils is constructed.

Greg

--
You received this message because you are subscribed to the Google Groups "Play Framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to play-framework+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/play-framework/568815a4-2084-4def-98b5-919e0022d8dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Greg Methvin
Senior Software Engineer

Reply all
Reply to author
Forward
0 new messages