spring中bstractApplicationContext讲解.docVIP

  • 5
  • 0
  • 约8.15万字
  • 约 10页
  • 2016-12-03 发布于河南
  • 举报
spring中bstractApplicationContext讲解

AbstractApplicationContext ApplicationContext的抽象实现,这里采用了模版方法的设计模式,需要具体的子类去具体实现这些抽象方法。 这个类中,最重要的就是refresh()方法,虽然其中很多方法都需要子类去实现,但是,我们还是需要对其中调用的方法做一个详细的说明! protected void prepareRefresh() { this.startupDate = System.currentTimeMillis(); synchronized (this.activeMonitor) { this.active = true; } if (logger.isInfoEnabled()) { (Refreshing + this); } } 这个方法有个比较重要的地方,就是this,通过日志记录getClass(),我们发现,这个this并不是AbstractApplicationContext,而是ClassPathXmlApplicationContext(这个地方,在我以前的关于class的说明中有,一定要记住)! 再一个就是,当我()出来的结果让我有点意外,如下: Refreshing org.springframework.context.support.ClassPathXmlApplic

文档评论(0)

1亿VIP精品文档

相关文档