【问题标题】:How does a Grails plugin add its own URLMappings?Grails 插件如何添加自己的 URLMappings?
【发布时间】:2012-01-26 23:12:08
【问题描述】:

我正在创建一个 Grails 插件,我希望它添加自己的 UrlMappings。使用插件的应用程序会忽略插件源中的UrlMappings.groovy 文件,那么这些应该在哪里定义呢?

【问题讨论】:

    标签: grails plugins configuration url-mapping


    【解决方案1】:

    http://grails.org/doc/latest/guide/single.html#plugins:Notes on excluded Artefacts

    In addition, although UrlMappings.groovy is excluded 
    you are allowed to include a UrlMappings definition with 
    a different name, such as MyPluginUrlMappings.groovy.
    

    【讨论】:

    • 它对我不起作用。当我运行主项目时,我得到ERROR commons.DefaultGrailsApplication - The class [MyPluginUrlMappings] was not found when attempting to load Grails application. Skipping.
    • @CassioLandim 您的班级名称必须是 MyPluginUrlMappings 而不是 UrlMappings
    • @CassioLandim 谢谢你的评论。我忘了它是一个类并且有一个类定义......
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-01-14
    • 1970-01-01
    • 2011-06-20
    • 2021-10-06
    • 1970-01-01
    相关资源
    最近更新 更多