Record some pits

Grails3.2 -Version can be directly indomainIn the injectionserviceIn theGrails3.2 +Auto injection is disabled by default

Open means

  • Methods a

Configure the global mapping in application.groovy, or create one if you don’t have this script

grails.gorm.default.mapping = {
    autowire true
}
Copy the code
  • Way 2

Add the mapping to the domain where the bean needs to be injected

static mapping = {
    autowire true
}
Copy the code
  • Methods three

Add or modify configurations in application.yml

---
grails:
    gorm:
        autowire: true
Copy the code

reference