0

I'm migrating a 2.5.6 app to 3.3.10. When generating controllers, detected that a service was created and used from the controllers auto-generated code. Looking at the service, is just an interface.

Looking at the grails generate-controller documentation, I can't find information about that "interface service"

http://docs.grails.org/3.3.10/ref/Command%20Line/create-controller.html

What that service is doing internally is also a mistery, and it's not clear what/where should I touch the code when I need to customize any of those methods in the service. I guess this is a new thing in Grails 3.3.x but not sure where to find more info.

So the concrete questions are:

  1. What is the purpose of that interface service?
  2. Where is that documented?
  3. How to customize? Like being implemented by a custom service?

Sample service:

import grails.gorm.services.Service

@Service(SyncLog)
interface SyncLogService {

    SyncLog get(Serializable id)

    List<SyncLog> list(Map args)

    Long count()

    void delete(Serializable id)

    SyncLog save(SyncLog syncLog)

}
4

1 回答 1

2

该接口服务的目的是什么?

它是您的数据访问层的起点。

这是在哪里记录的?

http://gorm.grails.org/latest/hibernate/manual/index.html#dataServices

如何定制?

它是一个界面,您可以编辑和添加/删除您喜欢的任何查询方法。上面链接的文档描述了很多细节。

于 2019-10-05T19:12:33.253 回答