Results 1 to 5 of 5

Thread: cflow in XML definition

  1. #1
    Join Date
    Oct 2005
    Posts
    3

    Default cflow in XML definition

    Hi,

    first of all, I'm pretty new to Spring AOP, so sorry for asking stupid questions.

    I'd like to define, in a springconfig.xml file, a cflow pointcut. As far as I have seen so far, beans created through the ProxyFactoryBean are bound to interceptors via the "interceptorNames" property.

    The interceptors, in the examples I've seen, implement the PointcutAdvisor interface.

    Now, there is a ControlFlowPointcut, but no corresponding advisor.

    How do I, in the XML file, describe the binding to a cflow pointcut? What concrete advisor beans do I have to use?

    Thanks in advance,

    Michael

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    Hopefully this example will help:
    Code:
    	<bean id="myPointcut" class="org.springframework.aop.support.ControlFlowPointcut">
            <constructor-arg index="0" >
                <value>forum9652.cflow.Outer</value>
            </constructor-arg> 
    	</bean>
    
        <bean id="cFlowAdvisor" class="org.springframework.aop.support.DefaultPointcutAdvisor">
            <property name="pointcut">
                <ref local="myPointcut"/>
            </property>
            <property name="advice">
                <ref local="advice"/>
            </property>
        </bean>

    If Outer defines:
    Code:
        public String doSomethingOne&#40;int i&#41; &#123;
            return proxiedObject.doSomething1&#40;i&#41;;
        &#125;
    Then
    Code:
    new Outer&#40;proxiedObject&#41;.doSomethingOne&#40;1&#41;;
    will be advised, but:
    Code:
            TestBean tb = &#40;TestBean&#41; ctx.getBean&#40;"testBean"&#41;;
            String result = tb.doSomething1&#40;10&#41;;
    won't be.

  3. #3
    Join Date
    Oct 2005
    Posts
    3

    Default

    Hi,

    thanks. This already improves my understanding, but I was actually up to formulating, in Spring XML configuration, a pointcut like ths one (in AspectJ syntax):

    Code:
    execution&#40;SomeClass.someMethod&#40;&#41;&#41; && cflow&#40;execution&#40;SomeOtherClass.someOtherMethod&#40;&#41;&#41;&#41;
    From what you have posted, it seems that the cflow matches when a method is called from a certain object, not from some other control flow.

    Is that possible in Spring AOP?

    Thanks,

    Michael

  4. #4
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,104

    Default

    There is currently no way to specify that a pointcut executes below another pointcut
    See Control flow pointcuts

  5. #5
    Join Date
    Oct 2005
    Posts
    3

    Default

    Hi,

    oops. I thought I had read that section. :shock:

    Thanks a lot!

    Michael

Similar Threads

  1. Order of Bean definitions matters?
    By cfuser in forum Container
    Replies: 2
    Last Post: Oct 21st, 2005, 10:29 AM
  2. UnknownAdviceTypeException
    By dbendlin in forum Security
    Replies: 5
    Last Post: Sep 19th, 2005, 07:57 AM
  3. Replies: 1
    Last Post: Jun 9th, 2005, 08:37 AM
  4. Converting bean types in a beans definition file
    By davidcnoel in forum Container
    Replies: 5
    Last Post: Oct 11th, 2004, 10:46 AM
  5. Replies: 5
    Last Post: Aug 27th, 2004, 07:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •