问答详情
源自:2-1 使用AOP处理请求(上)

谁能帮忙解释一下,这里为什么加@Component 注解???

@Aspect @Component  //谁能帮忙解释一下,这里为什么加@Component 注解??? public class HttpAspect {    @Before("execution(public * com.imooc.controller.GirlController.*(..))")    public void log(){    System.out.println("log-log-log-log");    } }

提问者:慕瓜6597882 2017-09-11 11:29

个回答

  • 慕用9126763
    2017-09-11 20:42:44
    已采纳

    因为要扫描这个类,又因为没有对应的注解,只能用这个可以说是万能的@Component注解吧,更详细的可以去找度娘