记录一下一些坑

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

参考