java - How exactly Spring use JDK proxy? -


i have doubts related 2 kinds of proxies can use spring.

enter image description here

so, have understand jdk proxy type default 1 used spring , based on interface implementation.

from have understand (but absolutly not sure assertion, correct me if wrong) using jdk proxy both class of object "wrapped" proxy , proxy have implement interface.

what represent interface? interface contains not implemented methods declaration. method are?

studying on online documentation found link: http://docs.spring.io/autorepo/docs/spring/3.2.3.release/javadoc-api/org/springframework/context/annotation/enableaspectjautoproxy.html

here shown example of jdk proxy use aop behavior have doubts related previous interface use.

so, can see in link, there are:

  1. the appconfig configuration class

     @configuration  @enableaspectjautoproxy  public class appconfig {      @bean      public fooservice fooservice() {          return new fooservice();      }       @bean      public myaspect myaspect() {          return new myaspect();      }  } 

i think @enableaspectjautoproxy enable use of jdk proxy adding aspect behavior (is true?)

in class definied 2 beans fooservice , myaspect.

  1. fooservice typical pojo component:

public class fooservice { // various methods }

  1. myaspect @aspect-style aspect:

    @aspect public class myaspect { @before("execution(* fooservice+.*(..))") public void advice() { // advise fooservice methods appropriate } }

in scenario above, @enableaspectjautoproxy ensures myaspect processed , fooservice proxied mixing in advice contributes.

so doubts are: if fooservice bean proxied why don't explicitly implement interface (i think) have jdk proxy? missing?

tnx


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -