spring aop 源码分析(三) @Scope注解创建代理对象


	spring aop 源码分析(三) @Scope注解创建代理对象
[编程语言教程]

一.源码环境的搭建:

@Component
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_SINGLETON,proxyMode = ScopedProxyMode.TARGET_CLASS)
public class MyMath implements Calc{

   public Integer add(int num1,int num2){
        return num1+num2;
    }
}
@Configuration @ComponentScan("com.yang.xiao.hui.aop") public class App { public static void main( String[] args ) { ApplicationContext ctx = new AnnotationConfigApplicationContext(App.class); MyMath myMath = (MyMath)ctx.getBean("myMath"); System.out.println(myMath.getClass()); System.out.println(ctx.getBean("scopedTarget.myMath").getClass()); } }
hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » spring aop 源码分析(三) @Scope注解创建代理对象