Play Framework 2.6 compile error with twirl - ambiguous implicit value (play.api.mvc.MessagesRequestHeader)

I am creating sample for for sign in, The form is not compiling. The error is also put in below code section under error comment. While searching for solution, I found this issue in 2.4.x of Play Framework. How to resolve this?

//template
/** Clarification on this  import*/
@import play.api.data.Form
@import play.api.mvc.MessagesRequestHeader
@import controllers.LoginDTO
@(loginForm: Form[LoginDTO])(implicit request: MessagesRequestHeader)

@helper.form(action = routes.FormTest.post()) {
    @helper.inputText(loginForm("userName"))
    @helper.inputText(loginForm("password"))
    <button>Create widget</button>
}


case class LoginDTO(userName: String, password: String)
object LoginDTO {
  implicit val format = Json.format[LoginDTO]
}

//Controller class
class FormTest @Inject() (cc: MessagesControllerComponents) extends MessagesAbstractController(cc) with I18nSupport{
  
  val loginForm = Form (
    mapping  (
      "userName" -> text,
      "password" -> text
    ) (LoginDTO.apply) (LoginDTO.unapply)
  )
  def login() = Action { implicit request: MessagesRequest[AnyContent] =>
    Ok(views.html.login_form(loginForm))
  }

  def post = ???
}

//Error

[error] /Users/vishalupadhyay/Work/app/views/login_form.scala.html:11:22: ambiguous implicit values:
[error]  both method implicitJavaMessages in object PlayMagicForJava of type => play.api.i18n.Messages
[error]  and value request of type play.api.mvc.MessagesRequestHeader
[error]  match expected type play.api.i18n.MessagesProvider
[error]     @helper.inputText(loginForm("userName"))
[error]                      ^
[error] /Users/vishalupadhyay/Work/app/views/login_form.scala.html:12:22: ambiguous implicit values:
[error]  both method implicitJavaMessages in object PlayMagicForJava of type => play.api.i18n.Messages
[error]  and value request of type play.api.mvc.MessagesRequestHeader
[error]  match expected type play.api.i18n.MessagesProvider[spoiler]This text will be hidden[/spoiler]
[error]     @helper.inputText(loginForm("password"))

Most Play Framework 2.6 form examples I have found any import in template. But when I am not importing , its complaining the same. Please let me know if I am missing something.