1
回答
spring源码疑惑
百度AI开发者大赛带你边学边开发,赢100万奖金,加群:418589053   

protected void prepareBeanFactory(ConfigurableListableBeanFactory beanFactory) {

这个函数中为什么要对以下接口忽略自动装配?

beanFactory.ignoreDependencyInterface(ResourceLoaderAware.class);
 beanFactory.ignoreDependencyInterface(ApplicationEventPublisherAware.class);
  beanFactory.ignoreDependencyInterface(MessageSourceAware.class);
  beanFactory.ignoreDependencyInterface(ApplicationContextAware.class);
   beanFactory.ignoreDependencyInterface(EnvironmentAware.class);

为什么要对以下接口指定装配实列?

beanFactory.registerResolvableDependency(BeanFactory.class, beanFactory);
 beanFactory.registerResolvableDependency(ResourceLoader.class, this);
 beanFactory.registerResolvableDependency(ApplicationEventPublisher.class, this);
 beanFactory.registerResolvableDependency(ApplicationContext.class, this);

<无标签>
举报
顶部