java - How exactly Spring use JDK proxy? -
i have doubts related 2 kinds of proxies can use spring.
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:
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.
- fooservice typical pojo component:
public class fooservice { // various methods }
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
Post a Comment