0

In Play 2.4.x we are now writing our controllers using class instead of objects. Does this mean there is a new instance of a controller per request?

If yes, can someone show me in the source code where this happens, very curious to see how this works.

If yes, does this mean Play can now have before/after events that run before an action like other frameworks have instead of using filters?

cool breeze
  • 4,461
  • 5
  • 38
  • 67
  • 1
    By using "objects instead of class" you will get [singleton objects](http://docs.scala-lang.org/tutorials/tour/singleton-objects.html). Are your questions phrased properly? – marcospereira Feb 18 '16 at 20:49
  • what do you mean 'instead of using filters'? There is a difference between intercepting the request (ie. filters) and running code when a controller is instantiated and torn down. – rethab Feb 19 '16 at 10:35
  • @marcospereira I meant the other way around, from singletons to classes. – cool breeze Feb 19 '16 at 15:26
  • Check this answer: http://stackoverflow.com/a/34867199/4600 – marcospereira Feb 19 '16 at 16:34

0 Answers0