TestAop.java 598 B

123456789101112131415161718192021
  1. package com.lovecoding.aop;
  2. import com.lovecoding.SpringConfig;
  3. import org.springframework.context.annotation.AnnotationConfigApplicationContext;
  4. public class TestAop {
  5. public static void main(String[] args) {
  6. AnnotationConfigApplicationContext context =
  7. new AnnotationConfigApplicationContext(SpringConfig.class);
  8. // CounterAop bean = context.getBean(CounterAop.class);
  9. // bean.add( 5, 5 );
  10. // bean.sub( 10, 5 );
  11. Counter bean = context.getBean("countterImpl", Counter.class);
  12. //bean.add(5, 5);
  13. bean.sub(5, 5);
  14. }
  15. }