Announcement Announcement Module
Collapse
No announcement yet.
AOP on an @Endpoint Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP on an @Endpoint

    Is there any reason why basic Spring AOP won't work on @Endpoints?

  • #2
    No, are you having trouble with it?

    Comment


    • #3
      I have encountered problem with using aop (methodSecurityInterceptor) around methods signed as @PayloadRoot. Aop is configured for interfaces.
      Code:
      	<aop:config proxy-target-class="false">
      		<aop:pointcut id="daoPointcut" expression="execution(* xyz.igv.dao.CesDao.*(..))"/>
      		<aop:pointcut id="facadePointcut" expression="execution(* xyz.igv.business.DbFacade+.*(..))"/>
      		<!--aop:pointcut id="cesPointcut" expression="execution(* xyz.igv.endpoint.CesEndPoint+.*(..))"/-->
      		<aop:advisor advice-ref="debugger" pointcut-ref="daoPointcut" order="1"/>
      		<aop:advisor advice-ref="methodSecurityInterceptor" pointcut-ref="daoPointcut" order="2"/>
      	</aop:config>
      daoPointcut, facadePointcut work okay. cesPointcut doesn't work. All of these are interfaces.

      I used some configuration as in Airline example. Using aop around my business facade works okay. Changing method interceptor to ws method lead to no method was invoked. I don't know why.
      I'd like to secure entire web service endpoint, not only business facade.
      Do you have any hints?

      Peter

      Comment


      • #4
        This is probably related to SWS-222. See http://opensource.atlassian.com/proj...browse/SWS-222. Will be fixed for 1.0.2.

        Comment


        • #5
          Still doesn't work. Really I don't if it is my fault.
          Jdk proxy won't create. On the dbFacade Jdk proxy is created well (see below).

          Code:
          [AspectJAwareAdvisorAutoProxyCreator]  - Creating implicit proxy for bean 'dbFacade' with 0 common interceptors and 1 specific interceptors
          [JdkDynamicAopProxy]  - Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [cz.cpost.eip.igv.business.impl.DbFacadeImpl@200e2d]
          But no one for the endpoint!
          I found an interesting message in Springs log:
          Code:
          [XmlWebApplicationContext]  - Bean 'org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
          Please do you have any suggestions???
          Thanks.
          Peter

          Comment


          • #6
            As a workaround, I just created a central controller with the dependencies being my old endpoints.

            Comment


            • #7
              So you mean controller with join to old endpoint? And that
              controller has annotations @Endpoint on methods that call
              old endpoints methods and proxy will be created on the old endpoint? Am I right? Please could you post part of code?
              BTW: I thought using new version 1.0.2 will solve that problem.

              Comment


              • #8
                Haven't really tried the new version in my last spring-ws project. If it solves the problem, then well and good. If it doesn't, here was my work-around. Let A, B, and C be my endpoints (that is, classes annotated with @Endpoint) implementing interfaces I, II, and III. Now, AOP didn't seem to work here. But if I created some class Z that implemented all the interfaces (I, II, and III) and has dependencies to objects implementing those interfaces, injecting an instances of AOP'd A, B, C will work out fine. Just remember to deactivate the @Endpoint of classes A, B, and C, and @Endpoint Z instead. Moreover, copy the related method annotations over to Z. It's not a nice approach, but it works. But hey, if the newer version fixed this, then well and good!

                Comment


                • #9
                  Thanks a lot. I will try it!
                  To the new version: I thought it was caused by SWS-222, but
                  probably it wasn't or maybe I am doing something wrong.

                  Comment

                  Working...
                  X