标签:min form string created pos 方法 containe under line
对于想要拥有自动装配能力,并且想把这种能力暴露给外部引用的BeanFactory类需要实现此接口。正常情况下,不要使用此接口应该更倾向于使用BeanFactory或者ListableBeanFactory接口。
/* * Copyright 2002-2016 the original author or authors.
* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed>*/ package org.springframework.beans.factory.config; import java.util.Set; import org.springframework.beans.BeansException; import org.springframework.beans.TypeConverter; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; /**
此接口主要是针对框架之外,没有向spring托管Bean的应用,通过暴露此功能,spring框架之外的程序,具有自动装配等spring的功能。
需要注意的是,ApplicationContext接口并没有实现此接口,因为应用代码很少用到此功能,如果确实需要的话,可以调用ApplicationContext的
getAutowireCapableBeanFactory方法,来获取此接口的实例。如果一个类实现了此接口,那么很大程序上它还需要实现BeanFactoryAware接口
它可以在应用上下文中返回BeanFactory
* * @author Juergen Hoeller * @since 04.12.2003 * @see org.springframework.beans.factory.BeanFactoryAware * @see org.springframework.beans.factory.config.ConfigurableListableBeanFactory * @see org.springframework.context.ApplicationContext#getAutowireCapableBeanFactory() */ public interface AutowireCapableBeanFactory extends BeanFactory { /** * Constant that indicates no externally defined autowiring. Note that * BeanFactoryAware etc and annotation-driven injection will still be applied.
常量,用于表示外部自动装配功能是否可用 ,但是此标识不影响正常的(基于注解的等)自动装配功能 * @see #createBean * @see #autowire * @see #autowireBeanProperties */ int AUTOWIRE_NO = 0; /** * Constant that indicates autowiring bean properties by name * (applying to all bean property setters).
常量,表示按照名称自动装配bean属性(适用于所有bean属性设置器) * @seespring源码 AutowireCapableBeanFactory接口
扫一扫手机访问
