variable not taking in consideration with velocity -
i want generate java class. create template velocity
@repository public class $classname extends baserepository<$bean, $searchdto> { @persistencecontext private entitymanager em; @autowired public $classname(entitymanager em) { super($bean.class, em); } } if pass value
classname=usersrepositoryimpl bean=users searchdto=userssearch i get
@repository public class usersrepositoryimpl extends baserepository<users, userssearch> { @persistencecontext private entitymanager em; @autowired public usersrepositoryimpl(entitymanager em) { super(class java.lang.string, em); } } seem issue $bean.class
tried "$bean.class" same issue
edit
put {} around work ${bean}
you need call
${bean}.class which tells velocity processor ${bean} velocity variable , .class static text of template. othherwise interpret $bean.class 1 expression, $bean string , $bean.class therefore printed using tostring method of string's class object.
Comments
Post a Comment