I wanted to add encryption to my application using the Jasypt library. Their integration page says to add a @TypeDef annotation:
"Define the encryption type with a @TypeDef annotation, which could be either inside the persisted entity class or inside a @TypeDefs declaration in a separate package-info.java file":
@TypeDef(
name="encryptedString",
typeClass=EncryptedStringType.class,
parameters= {
@Parameter(name="encryptorRegisteredName", value="myHibernateStringEncryptor")
}
)
However, I noticed that when I tried this on a groovy file, I received a syntax error.
"Groovy:unexpected token: } @ line 12, column 3."
When I copy and pasted the exact code into a java file it works fine. If I remove the parameters argument it works, I'm thinking that the parameters { } argument is being interpreted as a closure by groovy.
EDIT: I ended up moving the annotation to package-info.java but I still want to know why this doesn't work in groovy.