struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From developer researcher <java.developer.researc...@gmail.com>
Subject Problem using the Spring's AOP in Struts2's Actions with json-plugin
Date Sat, 06 May 2017 02:09:57 GMT
Hello,

I am using Strust 2 with spring-plugin and json-plugin to use:

1. Injection of dependencies: apparently everything is working well.
2. Spring's AOP: works when applied over methods of injected objects in the
Struts Actions but not when applied over methods of actions (my class
extends from ActionSupport and I use the @Action annotation at method level)

This situation has generated the following questions:

1. Are the actions created and managed by Spring or Struts? It's supposed
to be Spring, but I have this doubt because Spring's AOP is supposed to
work on Spring beans but in my case it does not work and because I do not
use the Spring's @Component annotation in the Action class

2. Is there a way to use Spring AOP in Struts2 Actions using the "JDK
dynamic proxies"? I have tested with the following results:

a) When Spring uses "JDK dynamic proxies" the Struts2 Action is not
executed and the following exception is thrown: NoSuchMethodException (see
NoSuchMethodException.txt)
b) When Spring uses "CGLIB proxy" in an Action whose result is of the
default type: the Action works correctly
c) When Spring uses "CGLIB proxy" in an Action whose result is of type
json: the Struts2 Action is executed but the following exception is thrown:
OperationNotSupportedException (see OperationNotSupportedException.txt).
When I do not use AOP this Action works correctly.

Thanks

Mime
View raw message