How concatenate two string in Spring Expression Language (SpEL)
I finally solve this. I add a new method in my controller:
public String getName() {
String nome_classe = entityClass.getSimpleName();
System.out.println("getName nome_class = "+nome_classe);
return nome_classe;
}
and now I use the annotation in that way:
@PreAuthorize("hasPermission(#user, 'cadastra_'+#this.this.name)")
To concatenate two strings in Spring EL you use concat
function . See here for more details :
Spring EL docs
for example, I used the following :
@PreAuthorize("hasRole('ROLE_'.concat(this.class.simpleName))")