0

i have a bean method : doXX (String a, String b) And, i use this method in an other one

class Y {

    X x;
    ...

    doYY () {
      ....
      x.doXX(A, B);
      ...
    }

}

i want to change the paramters A, B to specific values let's suppose that real values are : TEST, TEST I want to set them always : TEST_en, TEST_en (i want to add "_en") the method "doXX" is used a lot : so i don't want to change teh code source : it will take a lot of time.

Can i do it with AOP?

my container : Spring

sethu
  • 8,181
  • 7
  • 39
  • 65
Zied.Jabnoun
  • 140
  • 1
  • 2
  • 10

2 Answers2

0

What you are trying to do is not possible with Spring AOP because doYY and doXX are part of the same class. For the aspect to kick in, you need to call the method from another class. Check out the documentation for all the details

geoand
  • 60,071
  • 24
  • 172
  • 190
  • Thanks for the response : well, yes, it was a fault in the question. i edited it now :) – Zied.Jabnoun Mar 27 '14 at 09:20
  • Taking into account the edited question, for AOP to work, class X needs to be managed by Spring (where the aspect is applied) and class Y needs to be injected with the managed class X dependency – geoand Mar 27 '14 at 09:34
  • Thanks, i know all of that :). i am asking about AOP :). thanks for help – Zied.Jabnoun Mar 27 '14 at 10:06
0

Response :)

Aspectj overwrite an argument of a method

Community
  • 1
  • 1
Zied.Jabnoun
  • 140
  • 1
  • 2
  • 10