Play 2.x @ sign in route definitions

I'm studying the game! frames (2.3.x). I'm confused about the meaning of the "@" symbol in front of the controller in route definitions like this:

POST   /myresource/:id/custom   @controllers.MyResource.custom(id: Long)


As far as I can tell from the context I've seen it is probably related to the exact implementation of the controller (object vs class). Or am I completely wrong about this? I can't seem to find anything in the docs and the code I saw is not entirely explanatory. Can someone please explain?


source to share

1 answer

According to the documentation :

Play supports the creation of two types of routers, one is a dependency and the other is a static router. By default, a static router is used, but if you created a new Play app using the Game Seed Template Templates, your project will include the following configurations in build.sbt

, telling it to use the embedded router:

routesGenerator := InjectedRoutesGenerator


The code samples in the Plays documentation assume that you are using an injected route generator. If you don't use that, you can trivially adapt the code samples for a static route generator, either by prefixing the controller call portion with route a, @

or by declaring each of your controllers as object

a class


The Java equivalent will be static and non-stationary.



All Articles