How to link Custom interceptor using Annotation

前端 未结 1 995
-上瘾入骨i
-上瘾入骨i 2021-02-06 15:47

I had a custom interceptor in hand and I want it to be associated to an Action class using annotation. I had added interceptor-ref using the one declared in struts.xml but am ge

相关标签:
1条回答
  • 2021-02-06 16:20

    I do not have much exp using annotation with or without struts2 but i believe you are using convention-plugin.Here is a quick shot of what they saying about your problem.

    If you get errors like "Unable to find interceptor class referenced by ref-name XYZ". This means that the package where Convention is placing your actions, does not extend the package where the interceptor is defined. To fix this problem either

    1. Use @ParentPackage annotation(or struts.convention.default.parent.package) passing the name of the package that defines the interceptor.
    2. Create a package in XML that extends the package that defines the interceptor, and use @ParentPackage(or Struts.convention.default.parent.package) to point to it.

    For more details refer there documentation

    convention-plugin

    0 讨论(0)
提交回复
热议问题