【问题标题】:Why does JHipster not generating a DTO object for each domain?为什么 JHipster 不为每个域生成 DTO 对象?
【发布时间】:2016-05-10 14:14:30
【问题描述】:

我有点好奇。

为什么 JHipster 不为每个域对象生成一个 DTO 对象并将域对象直接发送到 UI 层?

-塔尔克斯

【问题讨论】:

    标签: jhipster


    【解决方案1】:

    DTO 生成是基于每个实体配置的,在您的实体 JSON 中使用 "dto": "mapstruct" 选项。

    有关如何使用 DTO 的指南以及为什么默认情况下不为每个实体启用 DTO 的说明,请查看此处的官方文档:http://jhipster.github.io/using-dtos/

    【讨论】:

      【解决方案2】:

      可以在entities.jdl文件中添加DTO生成

      dto * with mapstruct
      service * with serviceClass
      

      然后用jhipster import-jdl ./entities.jdl生成代码

      更多信息请看这里https://www.jhipster.tech/jdl/#optiondeclaration

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-02-19
        • 1970-01-01
        • 1970-01-01
        • 2021-02-12
        • 1970-01-01
        • 2015-02-12
        • 2019-05-13
        相关资源
        最近更新 更多