[build by hexo/next/gitalk/hexo-generator-search/LaTeX]"> Spring-用法-ApplicationContextAware接口的作用 发表于 2015-06-05 分类于 Java 加载Spring配置文件时,如果Spring配置文件中所定义的Bean类实现了ApplicationContextAware 接口,那么在加载Spring配置文件时,会自动调用ApplicationContextAware 接口中的 public void setApplicationContext(ApplicationContext context) throws BeansException 方法,获得ApplicationContext对象。 前提必须在Spring配置文件中指定该类