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

绿色网站建设背景的原因广州免费拍卖公司

绿色网站建设背景的原因,广州免费拍卖公司,重庆建设工程信息网加密狗无法登陆,网络公司网站模板html转载自 Spring Qualifier 注释 Spring Qualifier 注释 可能会有这样一种情况#xff0c;当你创建多个具有相同类型的 bean 时#xff0c;并且想要用一个属性只为它们其中的一个进行装配#xff0c;在这种情况下#xff0c;你可以使用 Qualifier 注释和 Autowired 注释通…转载自  Spring Qualifier 注释 Spring Qualifier 注释 可能会有这样一种情况当你创建多个具有相同类型的 bean 时并且想要用一个属性只为它们其中的一个进行装配在这种情况下你可以使用 Qualifier 注释和 Autowired 注释通过指定哪一个真正的 bean 将会被装配来消除混乱。下面显示的是使用 Qualifier 注释的一个示例。 示例 让我们使 Eclipse IDE 处于工作状态请按照下列步骤创建一个 Spring 应用程序 步骤描述1创建一个名为 SpringExample 的项目并且在所创建项目的 src 文件夹下创建一个名为 com.tutorialspoint 的包。2使用 Add External JARs 选项添加所需的 Spring 库文件就如在 Spring Hello World Example 章节中解释的那样。3在 com.tutorialspoint 包下创建 Java 类 StudentProfile 和 MainApp。4在 src 文件夹下创建 Beans 配置文件 Beans.xml。5最后一步是创建所有 Java 文件和 Bean 配置文件的内容并且按如下解释的那样运行应用程序。 这里是 Student.java 文件的内容 package com.tutorialspoint; public class Student {private Integer age;private String name;public void setAge(Integer age) {this.age age;} public Integer getAge() {return age;}public void setName(String name) {this.name name;} public String getName() {return name;} } 这里是 Profile.java 文件的内容 package com.tutorialspoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; public class Profile {AutowiredQualifier(student1)private Student student;public Profile(){System.out.println(Inside Profile constructor. );}public void printAge() {System.out.println(Age : student.getAge() );}public void printName() {System.out.println(Name : student.getName() );} } 下面是 MainApp.java 文件的内容 package com.tutorialspoint; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class MainApp {public static void main(String[] args) {ApplicationContext context new ClassPathXmlApplicationContext(Beans.xml);Profile profile (Profile) context.getBean(profile);profile.printAge();profile.printName();} } 考虑下面配置文件 Beans.xml 的示例 ?xml version1.0 encodingUTF-8?beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:contexthttp://www.springframework.org/schema/contextxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-3.0.xsdhttp://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-3.0.xsdcontext:annotation-config/!-- Definition for profile bean --bean idprofile classcom.tutorialspoint.Profile/bean!-- Definition for student1 bean --bean idstudent1 classcom.tutorialspoint.Studentproperty namename valueZara /property nameage value11//bean!-- Definition for student2 bean --bean idstudent2 classcom.tutorialspoint.Studentproperty namename valueNuha /property nameage value2//bean/beans 一旦你在源文件和 bean 配置文件中完成了上面两处改变让我们运行一下应用程序。如果你的应用程序一切都正常的话这将会输出以下消息 Inside Profile constructor. Age : 11 Name : Zara
http://wiki.neutronadmin.com/news/224632/

相关文章:

  • 如何做网站霸屏wordpress怎么安装模板
  • 用手机怎么做免费网站wordpress 获取链接地址
  • 张店网站设计新网站建设代理商
  • 大良网站智能推广机构网页设计心得500字
  • 深圳网站制作平台学做家常菜去那个网站
  • 网站系统开发团队简介宜春公司网站建设
  • 找网站建设的企业公司网站建设实施方案
  • 甘肃网络公司网站建设甘肃定西校园文化设计公司
  • 医院网站建设的规划 百度一下
  • 做推文的编辑网站网站建设相关优化
  • 网站建设公司 预算可以做描文本的网站
  • 郑州网站建设 seodz增加网站标签
  • 现在做什么网站好产品平面广告设计
  • 五金网站方案企业宣传网站建设内容
  • 唐山网站设计公司天津营销型网站建设公司
  • seo排行榜年度10佳网站苍溪规划和建设局网站
  • 用什么程序做网站最好优化个人网站源代码下载
  • 免费做网站哪里有免费ftp服务器空间
  • 网站营销方法学习网首页
  • 网站建设高校怎样做淘客网站
  • 做网站工作条件做新闻微网站有哪些方面
  • 北京市两学一做网站wordpress更改链接后网站打不开
  • 平台制作专业网站制作如何做网站轮播图和菜单全屏
  • 汽配网站开发wordpress导入数据库
  • 珠海网站建设维护网站设计评价
  • 电子商务网站建设实训实践总结wordpress迁服务器
  • 专业做医院网站vs2010网站开发登录代码
  • 诗人做的网站公司内部网站建设
  • 邢台做网站的价格究竟多少钱?wordpress的首页
  • 网站关键词的选择培训机构招生方案范文