{"action":"created","issue":{"url":"https://api.github.com/repos/playframework/playframework/issues/4288","labels_url":"https://api.github.com/repos/playframework/playframework/issues/4288/labels{/name}","comments_url":"https://api.github.com/repos/playframework/playframework/issues/4288/comments","events_url":"https://api.github.com/repos/playframework/playframework/issues/4288/events","html_url":"https://github.com/playframework/playframework/pull/4288","id":70693933,"number":4288,"title":"2.4.0-RC1 Docs For Static Routes With Twirl, Also Guice Problem","user":{"login":"mslinn","id":485818,"avatar_url":"https://avatars.githubusercontent.com/u/485818?v=3","gravatar_id":"","url":"https://api.github.com/users/mslinn","html_url":"https://github.com/mslinn","followers_url":"https://api.github.com/users/mslinn/followers","following_url":"https://api.github.com/users/mslinn/following{/other_user}","gists_url":"https://api.github.com/users/mslinn/gists{/gist_id}","starred_url":"https://api.github.com/users/mslinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mslinn/subscriptions","organizations_url":"https://api.github.com/users/mslinn/orgs","repos_url":"https://api.github.com/users/mslinn/repos","events_url":"https://api.github.com/users/mslinn/events{/privacy}","received_events_url":"https://api.github.com/users/mslinn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/playframework/playframework/milestones/16","html_url":"https://github.com/playframework/playframework/milestones/2.4.0","labels_url":"https://api.github.com/repos/playframework/playframework/milestones/16/labels","id":699619,"number":16,"title":"2.4.0","description":"","creator":{"login":"jroper","id":105833,"avatar_url":"https://avatars.githubusercontent.com/u/105833?v=3","gravatar_id":"","url":"https://api.github.com/users/jroper","html_url":"https://github.com/jroper","followers_url":"https://api.github.com/users/jroper/followers","following_url":"https://api.github.com/users/jroper/following{/other_user}","gists_url":"https://api.github.com/users/jroper/gists{/gist_id}","starred_url":"https://api.github.com/users/jroper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jroper/subscriptions","organizations_url":"https://api.github.com/users/jroper/orgs","repos_url":"https://api.github.com/users/jroper/repos","events_url":"https://api.github.com/users/jroper/events{/privacy}","received_events_url":"https://api.github.com/users/jroper/received_events","type":"User","site_admin":false},"open_issues":11,"closed_issues":64,"state":"open","created_at":"2014-06-24T06:48:17Z","updated_at":"2015-04-29T02:26:34Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-04-24T13:41:22Z","updated_at":"2015-04-29T03:00:19Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/playframework/playframework/pulls/4288","html_url":"https://github.com/playframework/playframework/pull/4288","diff_url":"https://github.com/playframework/playframework/pull/4288.diff","patch_url":"https://github.com/playframework/playframework/pull/4288.patch"},"body":"With 2.3.8, this dependency:\r\n\r\n    \"org.webjars\" %% \"webjars-play\" % \"2.4.0-M3-1\"\r\nAnd this route:\r\n\r\n    GET    /thing/create       controllers.ThingController.create\r\n\r\nAnd this static Controller:\r\n````\r\nobject ThingController extends Controller {\r\n  def create = Action { implicit request =>\r\n    Ok(thingViews.edit(newThingForm, None))\r\n  }\r\n}\r\n````\r\n\r\nCaused this Twirl template to render properly:\r\n\r\n````\r\n@(thingForm: Form[model.Thing], maybeThingId: Option[Long])(implicit request: RequestHeader)\r\n@import helper._\r\n// blah blah\r\ninputText(thingForm(\"sku\"))\r\n// blah blah\r\n}\r\n````\r\nHowever, after changing `plugins.sbt` to use Play 2.4.0-RC1 the above gives the following error for each inputText in the Twirl view:\r\n\r\n    could not find implicit value for parameter messages: play.api.i18n.Messages\r\n\r\nI tried adding the following imports to the controller as per the [migration docs](https://www.playframework.com/documentation/2.4.0-RC1/Migration24#Scala1):\r\n\r\n    import play.api.i18n.Messages.Implicits._\r\n    import play.api.Play.current\r\n\r\n... but I got the same error message. I realized I also had to change the Twirl template to this:\r\n\r\n    @(thingForm: Form[model.Thing], maybeThingId: Option[Long])(implicit request: RequestHeader, messages: Messages)\r\n\r\n... and it worked. The docs imply this change is necessary but dummies like me would benefit from a more explicit statement, something like \"Add an extra implicit parameter of type Messages to Twirl templates that handle forms\".\r\n\r\n## Part II\r\n\r\nChanging the route to this:\r\n\r\n    GET         /thing/create            @controllers.ThingController.create\r\n\r\nand changing the controller to this:\r\n\r\n    class ThingController(val messagesApi: MessagesApi) extends Controller with I18nSupport\r\n\r\nAnd changing the Twirl template to this:\r\n\r\n    @(thingForm: Form[model.Thing], maybeThingId: Option[Long])(implicit request: RequestHeader, messages: Messages)\r\n\r\nGives the error:\r\n\r\n````\r\n[ConfigurationException: Guice configuration errors:\r\n\r\n1) Could not find a suitable constructor in controllers.ThingController. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private.\r\n  at controllers.ThingController.class(Unknown Source)\r\n  while locating controllers.ThingController\r\n\r\n1 error]\r\n````"},"comment":{"url":"https://api.github.com/repos/playframework/playframework/issues/comments/97290361","html_url":"https://github.com/playframework/playframework/pull/4288#issuecomment-97290361","issue_url":"https://api.github.com/repos/playframework/playframework/issues/4288","id":97290361,"user":{"login":"mslinn","id":485818,"avatar_url":"https://avatars.githubusercontent.com/u/485818?v=3","gravatar_id":"","url":"https://api.github.com/users/mslinn","html_url":"https://github.com/mslinn","followers_url":"https://api.github.com/users/mslinn/followers","following_url":"https://api.github.com/users/mslinn/following{/other_user}","gists_url":"https://api.github.com/users/mslinn/gists{/gist_id}","starred_url":"https://api.github.com/users/mslinn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mslinn/subscriptions","organizations_url":"https://api.github.com/users/mslinn/orgs","repos_url":"https://api.github.com/users/mslinn/repos","events_url":"https://api.github.com/users/mslinn/events{/privacy}","received_events_url":"https://api.github.com/users/mslinn/received_events","type":"User","site_admin":false},"created_at":"2015-04-29T03:00:18Z","updated_at":"2015-04-29T03:00:18Z","body":"Big improvement :)\r\n\r\nAll of the new docs relies on `play.api.inject.Module` (DI modules) being understood, but it seems DI modules are not the same as [Play modules](https://www.playframework.com/documentation/2.4.x/Modules). \r\n\r\nThe `play.api.inject.Module` docs say: \"Dependency injection modules can be used by Play plugins to provide bindings for JSR-330 compliant ApplicationLoaders.  Any plugin that wants to provide components that a Play application can use may implement one of these.\" This suggests to me that the Module docs are for plugin authors, hence DI is just for Play plugin authors. This is reinforced by the name: Module. If that is not correct, some more context should be provided to the reader so they know what a Module is and how it related to DI.\r\n\r\nThe reader is probably confused about the difference between a Play Module and a plugin (at least, I am), and the relationship between DI Module and a plugin is also unknown."}}