Reputation: 11888
I have just updated to Play 2.5.2, and my filter (which runs on Login) gives me the following error :
ProvisionException: Unable to provision, see the following errors:
1) Error injecting constructor, java.lang.RuntimeException: There is no started application
at filters.LoginFilter.<init>(LoginFilter.scala:15)
I had to modify my code a bit to match the new changes set to Filter by the 2.5.2 :
import akka.stream.Materializer
import com.google.inject.Inject
import play.api.Play._
import play.api.cache.CacheApi
import play.api.mvc.Results._
import play.api.mvc.{Filter, RequestHeader, Result}
import scala.concurrent.{ExecutionContext, Future}
class LoginFilter @Inject() (implicit val mat: Materializer, ec: ExecutionContext) extends Filter {
}
I had to add the @Inject with Materializer otherwise I was having an error message saying that the class should be abstract or should implement Materializer.
How could I fix this issue ? thanks !
Upvotes: 2
Views: 1551
Reputation: 2302
I'm actually not sure about this one and honestly I don't know the difference but in all my files there is the javax.inject not the google inject, so it might be worth a try.
Instead of:
import com.google.inject.Inject
try:
import javax.inject.Inject
Upvotes: 1