How do configure struts convention plugin with struts-spring plugin with Action class mapped with annotations

后端 未结 1 1858
-上瘾入骨i
-上瘾入骨i 2020-12-12 03:04

I am trying to configure spring plugin with strut 2 application which is already running with convention plugin, so I am using annotations. I am using ExtJs for my form subm

相关标签:
1条回答
  • 2020-12-12 04:04

    You are importing both the struts2-spring-plugin, and the struts2-CDI-plugin.

    Don't.

    Choose only one of the above plugins, and then configure it properly:

    • To use the CDI plugin, simply import the JAR with Maven and start annotating the objects you want to be injected with the (right) @Inject annotation.

    • To use the Spring plugin, import the JAR, add the ContextLoaderListener in web.xml (that you have already set), and specify that you want to use Spring as objectFactory in struts.xml, with the constant:

      <constant name="struts.objectFactory" value="spring" /> 
      

    IMHO the CDI plugin is the better option, if you are using Java EE >= 6.

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