Actually I'am is skeptical about spring behavior behind the screen. I think I know the main difference between the proxy mechanism of JB, CGL and ASCJ. The aspectj auto proxy is active in my configuration class and the ASTJ class is included in the path.
My configuration
@configuration @ EnableAspectJAutoProxy (proxyTargetClass = true) Public class ApplicationConfiguration {...}
identified caste dependencies
& lt; Dependency & gt; & Lt; Group & gt; Org.aspectj & lt; / Group & gt; & Lt; ArtifactId & gt; Aspectjrt & lt; / ArtifactId> & Lt; Version & gt; 1.8.5 & lt; / Edition & gt; & Lt; / Dependencies & gt;
Using this simple setup, I have assumed that the work of bean injection but instead of messages like "codewriting error" s as a result of my application " [...] field [...] can not be set to com.sun.proxy. $ Proxy30 " This means that Spring uses the JBI proxy for my service, even with ASTJP proxy.
Finally I thought that the interface on my service is due to this behavior that when Spring decides to use the J2ee proxy, when my service implements an interface if I remove them I give it, so it works.
Failure:
@ service public class with validity MyService implemented Interface 1, Interface 2 {@ Override Public Zero Law FROMInterface1 () {} Override Public Zero Law FROMInterface2 () {} Public Null Service Method () {}}
OK:
@ Service Valid Public Class MyService {Public Zero Law FROMInterface1 () {} Public Null Method FROMInterface2 () {} Public Null Service Method () {}}
So far I have understood that for JPI proxy The tarfaces are required but it is new to me, that does not work with a cglib / aspectj proxy bean that implements the interface
Is there any way ...
. Do not force the G2ee proxy to use spring?
... cglib / aspectj
edit to recover the force: example updated, Edit2: Resolve: affected by @
pattern @ Validated
@Validated
by Is
MethodValidationPostProcessor
. Therefore, the property proxyTargetClass
has to be set to true
for this bean.
@ Bean Public LegislaturePost Processor LegalpollProcessor () {Final Legislative Process Processors Legislative Postpost Processors; MethodValidationPostProcessor = New MethodValidationPostProcessor (); MethodValidationPostProcessor.setProxyTargetClass (true); Return method validity post processor; }
Annotation applies to @sepect
annotation, Not on @ Transactions
For this annotation, you need to comment on the @configuration
class on the proxyTargetClass = true
attribute value.
@configuration @ EnableAspectJAutoProxy (proxyTargetClass = true) @EnableTransactionManagement (proxyTargetClass = true) Public class ApplicationConfiguration {...}
No comments:
Post a Comment