当前位置: 首页 > 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://www.yutouwan.com/news/224632/

相关文章:

  • 徐州制作网站的公司有哪些公主坟网站建设
  • 自助网站建设开发asp.net网站开发试题
  • 手机网站产品展示模板网站建设从化
  • c#网站开发技术wordpress默认排序
  • 医院网站后台管理系统登录网站关键词优化应该怎么做
  • 网页设计和网站开发有什么区别电商网站建设与运营方向就业前景
  • 芜湖门户网站建设多少钱如何提高权重
  • 中国建设银行宁夏分行网站手机网站建设哪里好
  • 美食网站的建设目的交易所网站开发
  • 内江市规划建设教育培训中心网站企业网站建设服务电话
  • 网站建设的意义与价值长安网站建设公司
  • 开封网站开发大连网站建设制作公司
  • 南博网站建设福建省 园区网互联及网站建设 网络部分题目
  • 如何看还在建设的网站有模版之后怎么做网站
  • 货运代理网站模板网络设置了代理怎么关闭
  • 给人做ppt的网站吗高清图片素材网
  • 宣城网站开发专业制广州广告公司
  • 网站的seo优化方案梅州建站
  • 金坛网站建设公司服装设计与工程
  • 甘肃营销型网站建设做五金行业的外贸网站
  • 韶关营销网站开发网站建设敬请期待图片素材
  • 官方网站找oem做洗发水厂家推广app赚佣金
  • 唯美谷网站建设深圳优秀网站设计
  • 微信公众号 做不了微网站吗公司主页怎么制作
  • 防下载 的视频网站 怎么做制作网页需要的技术
  • 衡阳电商网站建设网站建设丶金手指花总13
  • 网站数据分析建设有没有做任务一样的网站兼职
  • 北京朝阳网站建设海外广告公司
  • 网站 名词解释上海注册公司哪家好
  • 重庆市建设工程造价管理总站云南哪有网站建设推广