博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
4.3 spring-嵌入式beans标签的解析
阅读量:7140 次
发布时间:2019-06-28

本文共 1982 字,大约阅读时间需要 6 分钟。

  对于嵌入式的beans标签,想信大家很少使用过,或者接触过,起码,我本人就没用过. 它非常类似于Import标签所提供的功能;

使用如下:

  对这个beans没什么太多可讲,解析代码如下:

1 protected void doRegisterBeanDefinitions(Element root) { 2         String profileSpec = root.getAttribute(PROFILE_ATTRIBUTE); 3         // 处理profile属性 4         /* 5          * this is header... 6          *  7          * 
10 * 11 * web.xml12 * 13 *
14 * 15 *
Spring.profiles.active
16 * 17 *
dev
18 * 19 *
20 */21 if (StringUtils.hasText(profileSpec)) {22 Assert.state(this.environment != null,23 "Environment must be set for evaluating profiles");24 String[] specifiedProfiles = StringUtils.tokenizeToStringArray(profileSpec,25 BeanDefinitionParserDelegate.MULTI_VALUE_ATTRIBUTE_DELIMITERS);26 if (!this.environment.acceptsProfiles(specifiedProfiles)) {27 return;28 }29 }30 31 // Any nested
elements will cause recursion in this method. In32 // order to propagate and preserve
default-* attributes correctly,33 // keep track of the current (parent) delegate, which may be null. Create34 // the new (child) delegate with a reference to the parent for fallback purposes,35 // then ultimately reset this.delegate back to its original (parent) reference.36 // this behavior emulates a stack of delegates without actually necessitating one.37 // 专门处理解析38 BeanDefinitionParserDelegate parent = this.delegate;39 this.delegate = createDelegate(this.readerContext, root, parent);40 // 解析前留给子类实现41 preProcessXml(root);42 43 parseBeanDefinitions(root, this.delegate);44 // 解析后留给子类实现45 postProcessXml(root);46 47 this.delegate = parent;48 }

 

 

转载地址:http://zalrl.baihongyu.com/

你可能感兴趣的文章
dhcpcd 移植
查看>>
hdu 4676 Sum Of Gcd 莫队+phi反演
查看>>
Java关系操作符简写
查看>>
原博客地址http://blog.chinaunix.net/uid/20656672.html不再维护(10年前数百篇oracle/teradata性能优化、故障处理案例)...
查看>>
Java动态编程---动态代理
查看>>
GBDT(MART) 迭代决策树入门教程 | 简介
查看>>
第二十节,基本数据类型,集合set、综合应用新数据更新老数据
查看>>
架构设计:前后端分离之Web前端架构设计
查看>>
C#动态调用WCF接口(2)
查看>>
SQLAlchemy增删改查基本操作,及SQL基本技能样码(join,group)
查看>>
Python中获取当前日期的格式
查看>>
win10 安装visual studio 2015遇到的坑
查看>>
机器学习——基于概率论的分类方法:朴素贝叶斯
查看>>
Spring中的Interceptor 拦截器 专题
查看>>
mysql计算连续天数,mysql连续登录天数,连续天数统计
查看>>
用离散傅里叶变换实现线性卷积
查看>>
IIS7.5配置SSL
查看>>
Hadoop HBase概念学习系列之HBase里的HRegion(五)
查看>>
HBase、Hive、MapReduce、Hadoop、Spark 开发环境搭建后的一些步骤(export导出jar包方式 或 Ant 方式)...
查看>>
[Angular Directive] 3. Handle Events with Angular 2 Directives
查看>>