2016-03-15 19 views
6

Ho un Gioca quadro applicazione, versione 2.4 la migrazione a 2,5, tutto fatto! ma genera un errore nella mia azione personalizzata con BodyParser,Gioca Errore 2.5 Migrazione: azione personalizzata con BodyParser: non riusciva a trovare valore implicito per il parametro mat: akka.stream.Materializer

def isAuthenticatedAsync[A](parser: BodyParser[A])(f: => Long => Request[A] => Future[Result]) = { 
Security.Authenticated(userId, onUnauthorized) { user => 
    Action.async(parser)(request => f(user)(request)) 
} 

}

Utilizzare questa:

def upload = isAuthenticatedAsync(parse.maxLength(5 * 1024 * 1024, parse.multipartFormData)) { userId => request => 
//Logger.info(s"") 
request.body match { 
    case Left(MaxSizeExceeded(length)) => Future(BadRequest(Json.toJson(ResultTemp("Your file is too large, we accept just " + length + " bytes!")))) 
    case Right(multipartForm) => 

genera un errore:

could not find implicit value for parameter mat: akka.stream.Materializer 

[errore] def upload = Action.async (parse.maxLength (5 * 1024 * 1024, parse.multipartFormDa ta)) {richiesta =>

risposta

6

Sembra che è necessario iniettare un materializzatore nel controllore

class MyController @Inject() (implicit val mat: Materializer) {} 
+0

molte grazie a voi! –

+0

sei il benvenuto @ ĐạtThành. Goditi scala. –

Problemi correlati