BeanCreator.java 文件源码

java
阅读 33 收藏 0 点赞 0 评论 0

项目:gen-sbconfigurator 作者:
/**
 * Creates an instance of the bean.
 * 
 * @return the created instance
 * 
 * @throws Exception
 *             if the instance cannot be created
 */
protected Object createInstance() throws Exception {
    final Constructor<?> constructor = findMatchingConstructor();
    final Object object = constructor.newInstance(constArgs);

    // check if we have to apply properties
    if (properties != null && properties.size() > 0) {
        new BeanWrapperImpl(object).setPropertyValues(values);
    }

    // auto-wire everything if the factory supports that
    if (beanFactory instanceof AutowireCapableBeanFactory) {
        ((AutowireCapableBeanFactory) beanFactory).autowireBeanProperties(
                object, AutowireCapableBeanFactory.AUTOWIRE_NO, false);
    }

    return object;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号