问答详情
源自:6-1 课程总结

看到的视频中,看见了,还有就是框架中遇到的,总感觉模模糊糊

注解主要是做什么的?

提问者:水木无语 2016-03-08 18:43

个回答

  • vcfvct
    2016-03-08 22:31:57
    已采纳

    感觉annotation就是给你需要的类、field,method之类的加上元信息,这样你方便你自己parse。个人比较喜欢把custom annotation跟Spring的@Component一起使用,这样在spring bootstrap的时候可以通过applicationContext.getBeansWithAnnotation(YourCustomAnnontation.class);
    直接拿需要的annotation class(Bean),很方便, 可以做很多事情。