【问题标题】:Struts2's convention plugin doesn't scan jars in WEB-INF/libStruts2 的约定插件不扫描 WEB-INF/lib 中的 jars
【发布时间】:2013-06-23 22:19:03
【问题描述】:

我将一些动作打包在jar文件中,并将这些文件放在WEB-INF/lib中。 另外,我已经配置了 struts.convention.action.includeJars 常量。但我发现约定插件不会扫描 WEB-INF/lib 中的 jar。请参阅 org.apache.struts2.convention.PackageBasedActionConfigBuilder。

我的环境: - Tomcat 6.0.5 - struts2.3.14.3 GA - 春季 3.0.5

convention 插件如何扫描我的罐子?是否有任何方法可以重用 jar 文件中的操作。

【问题讨论】:

  • 它通过提供一个常量值进行扫描,该常量值用于将 jar 名称转换为正则表达式。你使用了什么 jar 名称或表达方式?
  • 但问题是约定插件不扫描 web-inf/lib,它只扫描 tomcat/lib 和 web-inf/classes。
  • 尝试添加struts.convention.action.fileProtocols=jar,zip

标签: struts2 jar convention


【解决方案1】:

struts2.3.14.3 GA 的约定插件有一个错误。

请参阅:link

获取最新版本的 PackageBasedActionConfigBuilder,然后在 struts.xml 中添加这些:

<bean type="org.apache.struts2.convention.ActionConfigBuilder" name="ActionConfigBuilder_bugfix" class="bugfix.struts2.PackageBasedActionConfigBuilder" />
<constant name="struts.convention.actionConfigBuilder" value="ActionConfigBuilder_bugfix" />

【讨论】:

  • 并且约定插件无法识别在 Eclipse 中导出的 jar。
猜你喜欢
相关资源
最近更新 更多
热门标签