Christian,

Are you looking to do something like this...

public Object unwrap(Object o) {
  Object result = o;
  if (Advised.class.isInstance(o)) {
    try {
      result = ((Advised)o).getTargetSource().getTarget();
    } catch (Exception e) {
      result = o;
    }
  }
  return result;
}

...within the process of turning your CandidateSteps into Steps?
I think that this would be doable
as an extension to the SpringStepsFactory but its been a while
since I've been in the JBehave code
as to know where that is needed.

You want the parsing to use the unwrapped object but the actual
usage to use the wrapped object.
Do I have that correct?

Brian

----- Original message -----
From: "Mauro Talevi" <[email protected]>
To: [email protected]
Date: Mon, 21 Nov 2011 20:55:44 +0100
Subject: Re: [jbehave-user] Annotated methods and aspect
orientation...

Yes, decoupling AOP from the DI is a good idea.
Sounds like we could provide an extension module to support AOP.
I would suggest creating a simple example that reproduces the
problem and shows what you're trying to do.
Cheers
On 21/11/2011 16:45, Christian Zulehner wrote:

  Hi,
  after some more investigation, I skipped hope for a quick
  fix... :-(
  Changing e.g. the SpringStepsFactory fixes only the step
  creation, but NOT the handling/matching logic.
  So this would need even more stuff  to be fixed/changed.
  And thinking of unspecified behaviour when overriding method
  based annotations,
  I guess this needs more conceptual work to be done, before
  implementing some quick hacks...  :-(
  I guess I'll give the AspectJ code weaving a try, instead of
  using Spring-AOP proxies...
  Mit freundlichen Grüßen
  Christian Zulehner
  Im Auftrag der Porsche Informatik GmbH
  [1][email protected]
  Porsche Informatik Gesellschaft m.b.H. | A – 5101 Bergheim |
  Handelszentrum 7
  Sitz: Salzburg | FN 72830 d / Landesgericht Salzburg | DVR
  88439 | UID ATU 36773309
  [2]http://www.porscheinformatik.at/
  Von:        Mauro Talevi [3]<[email protected]>
  An:        [4][email protected]
  Datum:        21.11.2011 14:36
  Betreff:        Re: [jbehave-user] Annotated methods and
  aspect orientation...
    _________________________________________________________

  Hi Christian,
  aop has not been a use case considered so far, so it may well
  be that
  it requires some updates to get it working.
  A Jira issue detailing the problem and a patch for it would be
  most
  welcome.
  Ideally, you should add both a unit test that reproduces the
  problem
  (in core if it affects AbstractStepsFactory) and an example
  (e.g. in
  trader-spring) that we can use as integration test.
  Cheers
  On Mon Nov 21 14:32:03 2011, Christian Zulehner wrote:
  > Hi all,
  >
  > currently I'm struggling to get JBehave to work together
  with aspect
  > orientated programming (AspectJ) and Spring.
  >
  > The problem seems to be, that the hasAnnotatedMethodsin
  > AbstractStepsFactoryis not able to discover methods, which
  are already
  > wrapped into an aspect proxy, e.g. logging, exception
  handling..
  >
  > IIRC @Inherited only works for annotated types, adding this
  to the
  > @Give, @When, ... won't change anything.
  > So, my guess is to update the implementaiton of
  hasAnnotatedMethodsto
  > take super-methods into account...
  >
  > Did anyone had a similar problem?
  > Is this a known issue?
  > If so, should I file a Jira entry? (Together with a fix?)
  >
  >
  >
  > Mit freundlichen Grüßen
  >
  > Christian Zulehner
  > Im Auftrag der Porsche Informatik GmbH
  >
  > Porsche Informatik Gesellschaft m.b.H. | A – 5101 Bergheim |
  > Handelszentrum 7
  > Sitz: Salzburg | FN 72830 d / Landesgericht Salzburg | DVR
  88439 | UID
  > ATU 36773309
  > _[5]http://www.porscheinformatik.at/_
  --------------------------------------------------------------
  -------
  To unsubscribe from this list, please visit:
     [6]http://xircles.codehaus.org/manage_email

References

1. mailto:[email protected]
2. http://www.porscheinformatik.at/
3. mailto:[email protected]
4. mailto:[email protected]
5. http://www.porscheinformatik.at/_
6. http://xircles.codehaus.org/manage_email
---
Brian Repko
LearnThinkCode, Inc.
http://www.learnthinkcode.com
email: [email protected]
phone: +1 612 229 6779

Reply via email to