【问题标题】:Grails 3 custom web.xml and weblogic.xmlGrails 3 自定义 web.xml 和 weblogic.xml
【发布时间】:2016-01-23 04:54:51
【问题描述】:

Grails 2 documentation 说有可能,但 Grails 3 文档并没有说什么。

如何将自定义 web.xml 和 weblogic.xml 添加到 Grails 3 应用程序战争?

【问题讨论】:

  • 因为 Grails 3 是在 Spring Boot 之上对 Grails 的重写,所以我会检查 Spring Boot 如何允许您添加这些 xml 文件。
  • 我找到了documentation,但我不明白该怎么做。

标签: tomcat grails gradle weblogic grails-3.0


【解决方案1】:

Grails 3.x 不使用 web.xml。自定义必须在 Spring 中完成。新的 servlet 和过滤器可以注册为 Spring bean 或分别使用 ServletRegistrationBean 和 FilterRegistrationBean。

在 Grails 中配置 Spring Bean 的文档: https://grails.github.io/grails-doc/3.0.x/guide/spring.html

http://grails.github.io/grails-doc/latest/guide/single.html#upgradingApps收集的信息

文章确实提到,措辞不佳,“虽然在 src/main/webapp/WEB-INF/web.xml 中仍然可以使用”

尝试在 src/main/webapp/WEB-INF/ 中创建一个 web.xml 文件,看看这是否能解决您的问题。

在以前版本的 grails 中你可以运行:

grails install-templates

这将生成用于构建应用程序的 web.xml grails。

【讨论】:

    【解决方案2】:

    我刚从 Graeme Rocher 于 2015 年 10 月 24 日发表的 JavaOne 演讲中了解到这一点。似乎不再支持 web.xml

    Here is the the video,演示开始大约一小时。 (幻灯片可在网站上下载)。以下是演示文稿的一些屏幕截图:




    【讨论】:

      猜你喜欢
      • 2014-07-24
      • 1970-01-01
      • 2015-04-10
      • 1970-01-01
      • 2016-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多