比如当应用启动时候往user表中添加一条数据,修改 grails-app\config\BootStrap.groovy 的代码:
class BootStrap {
def init = { servletContext ->
def user = new Users(id:1,username:'rain'
,password:'1102')
user.password = user.password.encodeAsPassword()
user.save()
}
def destroy = { }
}
posted on 2008-07-28 23:02
周锐 阅读(551)
评论(0) 编辑 收藏 所属分类:
Groovy&Grails