Spring的meta标签
生活随笔
收集整理的這篇文章主要介紹了
Spring的meta标签
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Spring的解析源碼
public void parseMetaElements(Element ele, BeanMetadataAttributeAccessor attributeAccessor) {
//獲取當前節點的所有子元素
NodeList nl = ele.getChildNodes();
for (int i = 0; i < nl.getLength(); i++) {
Node node = nl.item(i);
//提取meta
if (isCandidateElement(node) && nodeNameEquals(node, META_ELEMENT)) {
Element metaElement = (Element) node;
String key = metaElement.getAttribute(KEY_ATTRIBUTE);
String value = metaElement.getAttribute(VALUE_ATTRIBUTE);
//使用key、value構造BeanMetadataAttribute
BeanMetadataAttribute attribute = new BeanMetadataAttribute(key, value);
attribute.setSource(extractSource(metaElement));
//記錄信息
attributeAccessor.addMetadataAttribute(attribute);
}
}
}
meta屬性的使用
<metakey="special-data"value="sprecial stragey"/>
BeanDefinition bd;
StringbeanCategoriesExpression=(String)bd.getAttribute(CATEGORY_META_KEY);
總結
以上是生活随笔為你收集整理的Spring的meta标签的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 第三方控件下载篇
- 下一篇: 关于在在hue当中执行shell脚本使用