Play Framework For Scala: Compilation error[type Application is not a member of package controllers]

前端 未结 4 862
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-09 03:48

I try to compile a scala example in the book: \"Play for Scala\" but get a following compilation error on Play console:

C:\\Play\\exp\\ch6_implicits>activ         


        
相关标签:
4条回答
  • 2020-12-09 04:04

    Play 2.4, by default, generates a dependency injected router, unlike previously, when it used a static router. You have two options, remove the routesGenerator line from build.sbt so play will generate a static router, or (better) make your controllers classes instead of objects, and use dependency injection.

    0 讨论(0)
  • 2020-12-09 04:11

    Include below code into into your conf/application.conf file:

    play.allowGlobalApplication = true

    0 讨论(0)
  • 2020-12-09 04:27

    remove routesGenerator := InjectedRoutesGenerator from yout file build.sbt and all will work

    0 讨论(0)
  • 2020-12-09 04:29

    Change your object to a class like this:

    object Shop extends Controller with WithCart {
    class Shop extends Controller with WithCart {
    
    object Application extends Controller with WithCart {
    class Application extends Controller with WithCart {
    
    0 讨论(0)
提交回复
热议问题