twirl icon indicating copy to clipboard operation
twirl copied to clipboard

Play 2.8 and @this

Open Finu opened this issue 4 years ago • 1 comments

Hi.

I tried to inject

@import play.api.Play

@this(configuration: com.typesafe.config.Config)
@(error: Boolean)

<!DOCTYPE html>

into template to use it to obtain some information for footer. Problem is that compiled code results looks like class login @javax.inject.Inject()@javax.inject.Inject() /*3.6*/(configuration: com.typesafe.config.Config) extends ...

@javax.inject.Inject()@javax.inject.Inject() is inserted twice - and I have no idea why. Could any one have idea what might cause it ?

Finu avatar Jan 24 '22 20:01 Finu

@Finu I am pretty sure that is because you set

TwirlKeys.constructorAnnotations += "@javax.inject.Inject()"

in your build.sbt. Just remove that from your build.sbt. You don't have to set this yourself when using Play. That's because Play sets it for you already. Only when using twirl without Play you have to set this yourself.

mkurz avatar Jan 30 '22 07:01 mkurz

@Finu could you solve your problem?

mkurz avatar Dec 19 '22 10:12 mkurz

@Finu closing for now. Feel free to re-open if you think you still ran into a bug.

mkurz avatar Dec 23 '22 16:12 mkurz