当前位置: 首页 > news >正文

网站推广的方式有哪几种上海财务公司

网站推广的方式有哪几种,上海财务公司,vue做网站的好处,青岛专业网站设计的公司定义一个容器#xff0c;使用ConcurrentHashMap 做为单例对象的容器 先解析beans.xml得到第一个bean对象的信息#xff0c;id#xff0c;class#xff0c;属性和属性值使用反射生成对象#xff0c;并赋值将创建好的bean对象放入到singletonObjects集合中提供getBean(id)方…定义一个容器使用ConcurrentHashMap 做为单例对象的容器 先解析beans.xml得到第一个bean对象的信息idclass属性和属性值使用反射生成对象并赋值将创建好的bean对象放入到singletonObjects集合中提供getBean(id)方法可以返回对应的bean对象 monster bean public class Monster {private Integer id;private String name;private String skill;public Monster() {}public Integer getId() {return id;}public void setId(Integer id) {this.id id;}public String getName() {return name;}public void setName(String name) {this.name name;}public String getSkill() {return skill;}public void setSkill(String skill) {this.skill skill;}Overridepublic String toString() {return Monster{ id id , name name \ , skill skill \ };} } package com.sparrow.spring.application;import com.sparrow.spring.bean.Monster; import org.dom4j.Document; import org.dom4j.DocumentException; import org.dom4j.Element; import org.dom4j.io.SAXReader;import java.io.File; import java.util.List; import java.util.concurrent.ConcurrentHashMap;/*** Author: 诉衷情の麻雀* Description: TODO* DateTime: 2023/7/24 8:09**/ public class SpaApplicationContext {private ConcurrentHashMapString, Object singletonObjects new ConcurrentHashMap();//构造器 接收一个容器的配置文件public SpaApplicationContext(String iocBeanXmlFile) throws Exception {//1. 得到类加载路径String path this.getClass().getResource(/).getPath();//2.创建SaxReaderSAXReader saxReader new SAXReader();//3.得到Document对象Document document saxReader.read(new File(path iocBeanXmlFile));//4.得到rootElementElement rootElement document.getRootElement();ListElement elements rootElement.elements(bean);for (Element bean : elements) {String id bean.attributeValue(id);String classFullPath bean.attributeValue(class);Integer monsterId null;String name ;String skill ;//遍历bean下面的property属性ListElement property bean.elements(property);for (Element elementProperty : property) {//如果是id把值存起来if (id.equalsIgnoreCase(elementProperty.attributeValue(name))) {monsterId Integer.valueOf(elementProperty.attributeValue(value));} else if (name.equalsIgnoreCase(elementProperty.attributeValue(name))) {name elementProperty.attributeValue(value);} else if (skill.equalsIgnoreCase(elementProperty.attributeValue(name))) {skill elementProperty.attributeValue(value);}//利用反射 根据类的全路径 进行实例化Class? aClass Class.forName(classFullPath);Monster o (Monster) aClass.newInstance();o.setId(monsterId);o.setName(name);o.setSkill(skill);//放入容器中singletonObjects.put(id, o);}}}public Object getBean(String id) {return singletonObjects.get(id);} } beans.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean classcom.sparrow.spring.bean.Monster idmonster01property nameid value1/property namename value白骨精/property nameskill value吃唐僧//beanbean classcom.sparrow.spring.bean.Monster idmonster02property nameid value2/property namename value老鼠精/property nameskill value吸血//bean/beanspublic class Test {public static void main(String[] args) throws Exception {SpaApplicationContext spaApplicationContext new SpaApplicationContext(beans.xml);Monster monster02 (Monster) spaApplicationContext.getBean(monster02);Monster monster01 (Monster) spaApplicationContext.getBean(monster01);System.out.println(monster02);System.out.println(monster01);} }
http://www.sadfv.cn/news/223437/

相关文章:

  • root.txt文件放到您网站的根目录下免费制作企业宣传视频app
  • 仿阿里巴巴行业门户贸易网站模板wordpress公众号采集
  • 建立公司网站的重点wordpress 转换 html
  • 学做家常菜的网站 知乎wordpress设置按钮
  • 刷q币网站建设计算机培训机构排名
  • 什么网站可以接单做海报制作网站图片
  • 新网站怎么运营网站建设管理系统
  • 中国风配色网站登封做网站优化
  • html5软件下载电脑版百度网站标题优化
  • 外包网站怎么做seo郑州seo公司排名
  • 郑州建材网站建设计算机做网站开题报告
  • seo网站优化推荐网页设计软件列表html代码案例
  • 帝国cms怎么做网站声明出国用哪个地图app好
  • 图书馆网站建设网站的目的建设新网站
  • 建网站找哪家公司学跨境电商要多少钱
  • 访问不了服务器网站吗网站建设技巧讠金手指排名26
  • 彩票网站的建设didv 模板WordPress
  • 做棋牌网站违法网页翻译在哪
  • 济南的企业网站小型教育网站开发
  • 设计师个人网站欣赏 中国html网页源码
  • thinkphp3.2 企业网站源码表白网站制作系统源码
  • wordpress迁站到阿里云怎么做自己的网站后台教程
  • 网站程上传不知此网站枉做男人的网站
  • 合肥网站建设第一品牌网站建设佰首选金手指七
  • 建站方案策划书博客网站首页设计
  • 邢台网站建设报价多少钱wordpress yeti 主题
  • 内蒙古建设集团招聘信息网站淄博网站seo
  • 阳江网站seo服务网站运营推广策划书
  • 设计感很强的中文网站全屏网站 欣赏
  • 什么是seo网站优化郑州有什么好玩的