0

I need to know if we can apply advice(spring AOP) in middle of a method.I read some where that AOP is applicable only for bean method calls.But still i got this question. Please advise.

I got an idea by moving that piece of code to another method...

kriegaex
  • 63,017
  • 15
  • 111
  • 202
Kathiresan. N
  • 48
  • 1
  • 12
  • Please always show your code instead of asking abstract questions. People can help you better and maybe suggest solutions you never thought of. You are not describing your problem but one solution you have in your mind. This is called the [XY problem](https://meta.stackexchange.com/a/66378/309898) and your question suffers from it. – kriegaex Dec 25 '19 at 07:01
  • I do understand that but still this was bugging my head so thought ask Nd close immediately – Kathiresan. N Feb 18 '20 at 04:33
  • I am of course not the owner of this platform. I was talking about generally accepted conventions with regard to courtesy and netiquette. Just put yourself into the position of the people who are trying to help you by commenting or answering: You are the one looking for help, some people react quickly and you who wants something from the community let same community wait for feedback for months. Would you think that is polite? – kriegaex Feb 18 '20 at 07:20
  • Not worried abt disagreeing but I am happy there one sole who understood my question...react late is not a crime too...every one has their personal issues...so don't try to put someone under Ur shoes. – Kathiresan. N Feb 19 '20 at 08:53

1 Answers1

1

Spring AOP includes the following types of advice:

  • Before
  • After returning
  • After throwing
  • After (finally)
  • Around

So you cannot apply the advice in middle of a method. But moving the piece of code to another method should help.