Hi,

For some reason the message was cut and the text was incomplete. Here the
rest of the message:

My original application is based on annotations but for the demo
application I used the "struts.xml" file for the actions configuration
which is the natural and default configuration style of struts web
applications, besides I'm not sure how to replicate with annotations some
of the configuration variants for the tests.

There are many variables that I have been manipulating for the tests, which
generates multiple scenarios or test cases, my idea is to cover all but in
parts. These variables are:

1. Actions creation managed by struts or spring
2. Type of result of actions
3. Action classes that extend or not of ActionSupport
4. Use of  "JDK dynamic proxy" or "CGLIB proxy" in the Spring AOP
configuration
5. Set struts.objectFactory.spring.enableAopSupport to true or false
(although I see that it have already marked it as deprecated)

*Test Case 1:*

*Variables:*
1. Actions creation managed by Spring
2. Type of result of action: dispatcher (default)
3. Action classes that extend of ActionSupport
4. Use of  "JDK dynamic proxy" in the Spring AOP configuration
5. Set struts.objectFactory.spring.enableAopSupport to false (default)

*Result:*
1. The advice is executed correctly
2. The action is executed
3. The object injected by Spring is executed correctly
4.* An ERROR occurs in ParametersInterceptor*

*Note:* The error in ParametersInterceptor is solved using "CGLIB proxy"
instead of "JDK dynamic proxy" in the Spring AOP configuration.

*Test Case 2:*
*Variables: *The values of the variables is referential since apparently in
all the combinations the result is the same.
1. Actions creation managed by Spring
2. Type of result of action: json
3. Action classes that not extend of ActionSupport
4. Use of  "JDK dynamic proxy" in the Spring AOP configuration
5. Set struts.objectFactory.spring.enableAopSupport to false (default)

*Result:*
The following exceptions occur:
- javax.naming.OperationNotSupportedException
- java.lang.reflect.InvocationTargetException
- org.apache.struts2.json.JSONException

*Other case:*

In my tests, the problem of null injected objects in "
https://issues.apache.org/jira/browse/WW-4110"; occurs when the action
extends from AcctionSupport and the creation of the action is managed by
Struts (using struts.xml file), but I consider that if someone want to use
the Spring's AOP it is logical that the creation of the object where the
AOP will apply must be managed by Spring.

*Considerations for the tests:*

1. Actions creation managed by struts or spring: edit, modify, comment or
uncomment struts.xml and the SpringApplicationContext class
2. Type of result of actions: dispatcher (default): comment or uncomment
the AdviceExample class
@Pointcut("execution(*
org.examples.teststruts2xml.action.LoginAction.execute(..))")
@Pointcut("execution(*
org.examples.teststruts2xml.action.JsonAction.execute(..))")
3. Action classes that extend or not of ActionSupport:  edit, modify,
comment or uncomment the LoginAction or JsonAction classes
4. Use of  "JDK dynamic proxy" or "CGLIB proxy" in the Spring AOP
configuration: comment or uncomment the SpringApplicationContext class
@EnableAspectJAutoProxy(proxyTargetClass = true)
@EnableAspectJAutoProxy
5. Set struts.objectFactory.spring.enableAopSupport to true or false: edit,
modify, comment or uncomment struts.properties

My test environment is: windows 7 64 bit, JDK 1.8.112 and the libraries
included in the POM

Thanks



2017-05-17 20:40 GMT-05:00 developer researcher <
java.developer.researc...@gmail.com>:

> Hi Lukasz,
>
> I attached a demo application for the errors/problems encountered when
> working with the Spring AOP in Struts 2 web applications:
> https://drive.google.com/file/d/0BytJ23ahIM_-Mk5RamFnbWl6bzA/view?usp=
> sharing
>
> My original application is based on annotations but for the demo
> application I used the "struts.xml" file for the actions configuration
> which is the natural and default configuration style of struts web
> applications, besides I'm not sure how to replicate with annotations some
> of the configuration variants for the tests.
>
> There are many variables that I have been manipulating for the tests,
> which generates multiple scenarios or test cases, my idea is to cover all
> but in parts. These variables are:
>
> 1. Actions creation managed by struts or spring
> 2. Type of result of actions
> 3. Action classes that extend or not of ActionSupport
> 4. Use of  "JDK dynamic proxy" or "CGLIB proxy" in the Spring AOP
> configuration
> 5. Set struts.objectFactory.spring.enableAopSupport to true or false
> (although I see that it have already marked it as deprecated)
>
> *Test Case 1:*
>
> *Variables:*
> 1. Actions creation managed by Spring
> 2. Type of result of action: dispatcher (default)
> 3. Action classes that extend of ActionSupport
> 4. Use of  "JDK dynamic proxy" in the Spring AOP configuration
> 5. Set struts.objectFactory.spring.enableAopSupport to false (default)
>
> *Result:*
> 1. The advice is executed correctly
> 2. The action is executed
> 3. The object injected by Spring is executed correctly
> 4. *An ERROR occurs in ParametersInterceptor*
>
> *Note:* The error in ParametersInterceptor is solved using "CGLIB proxy"
> instead of "JDK dynamic proxy" in the Spring AOP configuration.
>
> *Test Case 2:*
> *Variables: *The values of the variables is referential since apparently
> in all the combinations the result is the same.
> 1. Actions creation managed by Spring
> 2. Type of result of action: json
> 3. Action classes that not extend of ActionSupport
> 4. Use of  "JDK dynamic proxy" in the Spring AOP configuration
> 5. Set struts.objectFactory.spring.enableAopSupport to false (default)
>
> *Result:*
> The following exceptions occur:
> - javax.naming.OperationNotSupportedException
> - java.lang.reflect.InvocationTargetException
> - org.apache.struts2.json.JSONException
>
> *Other case:*
>
> In my tests, the problem of null injected objects in "
> https://issues.apache.org/jira/browse/WW-4110"; occurs when the action
> extends from AcctionSupport and the creation of the action is managed by
> Struts (using struts.xml file), but I consider that if someone want to use
> the Spring's AOP it is logical that the creation of the object where the
> AOP will apply must be managed by Spring.
>
> *Considerations for the tests:*
>
> 1. Actions creation managed by struts or spring: edit, modify, comment or
> uncomment struts.xml and the SpringApplicationContext class
> 2. Type of result of actions: dispatcher (default): comment or uncomment
> the AdviceExample class
> @Pointcut("execution(* org.examples.teststruts2xml.ac
> tion.LoginAction.execute(..))")
> @Pointcut("execution(* org.examples.teststruts2xml.ac
> tion.JsonAction.execute(..))")
> 3. Action classes that extend or not of ActionSupport:  edit, modify,
> comment or uncomment the LoginAction or JsonAction classes
> 4. Use of  "JDK dynamic proxy" or "CGLIB proxy" in the Spring AOP
> configuration: comment or uncomment the SpringApplicationContext class
> @EnableAspectJAutoProxy(proxyTargetClass = true)
> @EnableAspectJAutoProxy
> 5. Set struts.objectFactory.spring.enableAopSupport to true or false: edit,
> modify, comment or uncomment struts.properties
>
> My test environment is: windows 7 64 bit, JDK 1.8.112 and the libraries
> included in the POM
>
> Thanks
>
> 2017-05-12 1:29 GMT-05:00 Lukasz Lenart <lukaszlen...@apache.org>:
>
>> 2017-05-11 22:15 GMT+02:00 developer researcher
>> <java.developer.researc...@gmail.com>:
>> > Hello Lukasz,
>> >
>> > Is curious but I have more problems when the value of "
>> > struts.objectFactory.spring.enableAopSupport" is true that when it is
>> > false. Unlike "https://issues.apache.org/jira/browse/WW-4110"; my
>> problem is
>> > not of object injection but of the execution of Spring AOP. It may be a
>> > versions theme of Struts and Spring.
>>
>> Thanks, looks like we can mark the flag as deprecated. And maybe you
>> are right, it can be na issue with different Spring versions.
>>
>> > In summary:
>> >
>> > 1. When struts.objectFactory.spring.enableAopSupport is false
>> > (default): One problem in the scenarios that I have tested.
>> >
>> > - AOP on methods of injected objects (in actions): works as expected.
>> > - AOP on methods of actions with results of the default type
>> > (dispacher):There are problems depending on whether the action extends
>> > ActionSupport or not, but they are manageable through Spring
>> configuration.
>> > - AOP on methods of actions with results of json type (using
>> > json-plugin):The exception "OperationNotSupportedException" occurs, I
>> have
>> > not found a solution through configuration.
>>
>> Maybe try to prepare a small demo app to demonstrate what problems do you
>> have?
>>
>>
>>
>> Regards
>> --
>> Ɓukasz
>> + 48 606 323 122 http://www.lenart.org.pl/
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>

Reply via email to