Grails3.2+新增了一些新東西

記錄一下一些坑

Grails3.2-版能夠直接在domain中注入service,在Grails3.2+中默認關閉了自動注入功能

開啓方式

  • 方式一
application.groovy中配置全局映射,若沒有此腳本需新建
grails.gorm.default.mapping = {
    autowire true
}
  • 方式二
在須要注入 beandomain中添加映射
static mapping = {
    autowire true
}
  • 方式三
application.yml中新增或修改配置
---
grails:
    gorm:
        autowire: true

參考

相關文章
相關標籤/搜索