请叫我头头哥
摘要: 请叫我头头哥在某些特殊的情况下,Bean需要实现某个功能,但该功能必须借助于Spring容器才能实现,此时就必须让该Bean先获取Spring容器,然后借助于Spring容器实现该功能。为了让Bean获取它所在的Spring容器,可以让该Bean实现ApplicationContextAware接口。ApplicationContextAware 通过它Spring容器会自动把上下文环境对象调用ApplicationContextAware接口中的setApplicationContext方法。在ApplicationContextAware的实现类中,就可以通过这个上下文环境对象得到Spring容器中的Bean。看到—Aware...... 阅读全文
posted @ 2021-01-01 21:14 请叫我头头哥 阅读(13546) 评论(1) 推荐(7) 编辑
//Setting ico for cnblogs