Accessing Grails services from src/groovy

前端 未结 3 872
伪装坚强ぢ
伪装坚强ぢ 2021-01-21 08:11

Grails services are abstractions used for implementing business logic (as well as connecting to backing services/DBs, etc.) outside of a controller. So in a typical controller y

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-21 09:02

    You can also get a service using grails.util.Holders

    Example:

    For injecting MyService service class, use Holders.applicationContext.getBean("myService")

    Where "myService" is the name of your service class in lower camel case.

提交回复
热议问题