水木无语
2016-03-08 18:43
注解主要是做什么的?
感觉annotation就是给你需要的类、field,method之类的加上元信息,这样你方便你自己parse。个人比较喜欢把custom annotation跟Spring的@Component一起使用,这样在spring bootstrap的时候可以通过applicationContext.getBeansWithAnnotation(YourCustomAnnontation.class);
直接拿需要的annotation class(Bean),很方便, 可以做很多事情。
全面解析Java注解
127209 学习 · 111 问题
相似问题
回答 4
回答 3