• The Spring Framework ConfigurableListableBeanFactory.java


      1 /*The Spring Framework ConfigurableListableBeanFactory.java */
      2 
      3 /*
      4  * Copyright 2002-2008 the original author or authors.
      5  *
      6  * Licensed under the Apache License, Version 2.0 (the "License");
      7  * you may not use this file except in compliance with the License.
      8  * You may obtain a copy of the License at
      9  *
     10  *      http://www.apache.org/licenses/LICENSE-2.0
     11  *
     12  * Unless required by applicable law or agreed to in writing, software
     13  * distributed under the License is distributed on an "AS IS" BASIS,
     14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     15  * See the License for the specific language governing permissions and
     16  * limitations under the License.
     17  */
     18 
     19 package org.springframework.beans.factory.config;
     20 
     21 import org.springframework.beans.BeansException;
     22 import org.springframework.beans.factory.ListableBeanFactory;
     23 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
     24 
     25 /**
     26  * Configuration interface to be implemented by most listable bean factories. In
     27  * addition to {@link ConfigurableBeanFactory}, it provides facilities to
     28  * analyze and modify bean definitions, and to pre-instantiate singletons.
     29  * 
     30  * <p>
     31  * This subinterface of {@link org.springframework.beans.factory.BeanFactory} is
     32  * not meant to be used in normal application code: Stick to
     33  * {@link org.springframework.beans.factory.BeanFactory} or
     34  * {@link org.springframework.beans.factory.ListableBeanFactory} for typical use
     35  * cases. This interface is just meant to allow for framework-internal
     36  * plug'n'play even when needing access to bean factory configuration methods.
     37  * 
     38  * @author Juergen Hoeller
     39  * @since 03.11.2003
     40  * @see org.springframework.context.support.AbstractApplicationContext#getBeanFactory()
     41  */
     42 public interface ConfigurableListableBeanFactory extends ListableBeanFactory, AutowireCapableBeanFactory, ConfigurableBeanFactory {
     43 
     44     /**
     45      * Ignore the given dependency type for autowiring: for example, String.
     46      * Default is none.
     47      * 
     48      * @param type
     49      *            the dependency type to ignore
     50      */
     51     void ignoreDependencyType(Class type);
     52 
     53     /**
     54      * Ignore the given dependency interface for autowiring.
     55      * <p>
     56      * This will typically be used by application contexts to register
     57      * dependencies that are resolved in other ways, like BeanFactory through
     58      * BeanFactoryAware or ApplicationContext through ApplicationContextAware.
     59      * <p>
     60      * By default, only the BeanFactoryAware interface is ignored. For further
     61      * types to ignore, invoke this method for each type.
     62      * 
     63      * @param ifc
     64      *            the dependency interface to ignore
     65      * @see org.springframework.beans.factory.BeanFactoryAware
     66      * @see org.springframework.context.ApplicationContextAware
     67      */
     68     void ignoreDependencyInterface(Class ifc);
     69 
     70     /**
     71      * Register a special dependency type with corresponding autowired value.
     72      * <p>
     73      * This is intended for factory/context references that are supposed to be
     74      * autowirable but are not defined as beans in the factory: e.g. a
     75      * dependency of type ApplicationContext resolved to the ApplicationContext
     76      * instance that the bean is living in.
     77      * <p>
     78      * Note: There are no such default types registered in a plain BeanFactory,
     79      * not even for the BeanFactory interface itself.
     80      * 
     81      * @param dependencyType
     82      *            the dependency type to register. This will typically be a base
     83      *            interface such as BeanFactory, with extensions of it resolved
     84      *            as well if declared as an autowiring dependency (e.g.
     85      *            ListableBeanFactory), as long as the given value actually
     86      *            implements the extended interface.
     87      * @param autowiredValue
     88      *            the corresponding autowired value. This may also be an
     89      *            implementation of the
     90      *            {@link org.springframework.beans.factory.ObjectFactory}
     91      *            interface, which allows for lazy resolution of the actual
     92      *            target value.
     93      */
     94     void registerResolvableDependency(Class dependencyType, Object autowiredValue);
     95 
     96     /**
     97      * Determine whether the specified bean qualifies as an autowire candidate,
     98      * to be injected into other beans which declare a dependency of matching
     99      * type.
    100      * <p>
    101      * This method checks ancestor factories as well.
    102      * 
    103      * @param beanName
    104      *            the name of the bean to check
    105      * @param descriptor
    106      *            the descriptor of the dependency to resolve
    107      * @return whether the bean should be considered as autowire candidate
    108      * @throws NoSuchBeanDefinitionException
    109      *             if there is no bean with the given name
    110      */
    111     boolean isAutowireCandidate(String beanName, DependencyDescriptor descriptor) throws NoSuchBeanDefinitionException;
    112 
    113     /**
    114      * Return the registered BeanDefinition for the specified bean, allowing
    115      * access to its property values and constructor argument value (which can
    116      * be modified during bean factory post-processing).
    117      * <p>
    118      * A returned BeanDefinition object should not be a copy but the original
    119      * definition object as registered in the factory. This means that it should
    120      * be castable to a more specific implementation type, if necessary.
    121      * <p>
    122      * NOTE: This method does not consider ancestor factories. It is only meant
    123      * for accessing local bean definitions of this factory.
    124      * 
    125      * @param beanName
    126      *            the name of the bean
    127      * @return the registered BeanDefinition
    128      * @throws NoSuchBeanDefinitionException
    129      *             if there is no bean with the given name defined in this
    130      *             factory
    131      */
    132     BeanDefinition getBeanDefinition(String beanName) throws NoSuchBeanDefinitionException;
    133 
    134     /**
    135      * Freeze all bean definitions, signalling that the registered bean
    136      * definitions will not be modified or post-processed any further.
    137      * <p>
    138      * This allows the factory to aggressively cache bean definition metadata.
    139      */
    140     void freezeConfiguration();
    141 
    142     /**
    143      * Return whether this factory's bean definitions are frozen, i.e. are not
    144      * supposed to be modified or post-processed any further.
    145      * 
    146      * @return <code>true if the factory's configuration is considered frozen
    147      */
    148     boolean isConfigurationFrozen();
    149 
    150     /**
    151      * Ensure that all non-lazy-init singletons are instantiated, also
    152      * considering {@link org.springframework.beans.factory.FactoryBean
    153      * FactoryBeans}. Typically invoked at the end of factory setup, if desired.
    154      * 
    155      * @throws BeansException
    156      *             if one of the singleton beans could not be created. Note:
    157      *             This may have left the factory with some beans already
    158      *             initialized! Call {@link #destroySingletons()} for full
    159      *             cleanup in this case.
    160      * @see #destroySingletons()
    161      */
    162     void preInstantiateSingletons() throws BeansException;
    163 
    164 }
    Code


    作者:Kei
    出处:http://www.cnblogs.com/ikei/
    本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.

     
  • 相关阅读:
    Tomcat 配置 项目 到tomcat目录外面 和 域名绑定访问(api接口、前端网站、后台管理网站)
    弹窗插件zDialog使用教程
    shiro+spring相关配置
    jQuery分页插件(jquery.page.js)的使用
    ueditor1.4.3配置过程(包含单独上传文件以及图片的使用),ueditor1.4.3上传配置(转 http://www.bkjia.com/webzh/1001016.html)
    ueditor1_4_3_3编辑器修改文章
    jquery获取当前select下拉选的属性值
    js点击标签时获取当前标签属性值
    mysql给root开启远程访问权限,修改root密码
    redis持久化配置
  • 原文地址:https://www.cnblogs.com/ikei/p/7160721.html
Copyright © 2020-2023  润新知