在grails 3中,默认服务范围是Singleton
,文档显示通过定义很容易覆盖它
static scope='request'
在服务类别中。是否可以更改应用程序的默认服务范围,类似于对
application.groovy
中的 Controller 执行的方法?特定的问题是插件中的Service类正在调用应用程序服务(这些服务是围绕
request
范围设计的)。这在grails 2中起作用,但是随着grails 3的升级,它不再起作用。
最佳答案
Is it possible to change the default scope for an application similar to the way it is done for controllers in application.groovy?
没有直接的支持,没有。您可以编写可以强加此更改的bean定义后处理器。
关于grails - Grails 3更改默认服务范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47336279/