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

做网站业务员怎么样湛江百度网站快速排名

做网站业务员怎么样,湛江百度网站快速排名,短视频软件开发,做网站资料准备目录 Bean的别名:id和name的地位等同 Bean的作用范围:scope单例与非单例 Bean的使用场景:什么时候交给容器?什么时候不交?​ Bean的别名实践(含代码) 如果看不懂下面的,例如不知道i…

目录

Bean的别名:id和name的地位等同

 Bean的作用范围:scope单例与非单例

 Bean的使用场景:什么时候交给容器?什么时候不交?​

 Bean的别名实践(含代码)


如果看不懂下面的,例如不知道id写在哪里的,请首先看这篇博文:Spring的IoC、Bean、DI的简单实现,难度:※※※-CSDN博客


 

Bean的别名:id和name的地位等同

 Bean的作用范围:scope单例与非单例

 Bean的使用场景:什么时候交给容器?什么时候不交?

 Bean的别名实践(含代码)

案例一:

 案例二:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"><bean id="cat" class="org.example.package2.Cat"/><bean id="dog" class="org.example.package2.Dog"/><bean id="animalSet" name="abc1234" class="org.example.AnimalSet"><property name="animal1" ref="cat"></property><property name="animal2" ref="cat"></property></bean>
</beans>

package org.example;import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class Main {public static void main(String[] args) {ApplicationContext iocContext = new ClassPathXmlApplicationContext("applicationConfig.xml");AnimalSet animalSet = (AnimalSet) iocContext.getBean("abc1234");System.out.println(animalSet);animalSet.animalSetSound();}
}
package org.example;import org.example.package1.Animal;public class AnimalSet{Animal animal1;Animal animal2;public void animalSetSound(){animal1.sound();animal2.sound();}public void setAnimal1(Animal animal1) {this.animal1 = animal1;}public void setAnimal2(Animal animal2) {this.animal2 = animal2;}}
package org.example.package2;
import org.example.package1.Animal;public class Cat implements Animal{@Overridepublic void sound(){System.out.println("cat sound");}
}
package org.example.package2;import org.example.package1.Animal;public class Dog implements Animal {public void sound() {System.out.println("dog sound");}
}
package org.example.package1;public interface Animal {void sound();
}

http://www.hkea.cn/news/527596/

相关文章:

  • 贵卅省住房和城乡建设厅网站周口seo推广
  • 搭建flv视频网站seo工具查询
  • 企业展示网站 数据库设计模板自助建站
  • 房地产设计师上海seo网络优化
  • wordpress迁移打不开百度seo泛解析代发排名
  • 网站兼容性测试怎么做微信营销软件群发
  • wordpress如何设置内容页seo营销优化
  • 高端大气的网站制作南宁百度seo软件
  • 沙井营销型网站建设成人培训机构
  • 网站没有被百度收录搜索引擎排名优化公司
  • 手机网站转换小程序晋江怎么交换友情链接
  • 专业做网站的公司疫情放开最新消息今天
  • 不用写代码做网站软件长沙优化网站
  • o2o商城网站建设方案广告策划案优秀案例
  • 日照做网站的那家做的好百度网页链接
  • 建设云个人证件查询系统上海seo培训
  • 网站流量提供商杭州seo排名
  • 做装饰工程的在什么网站投标自建站
  • 地球人--一家只做信誉的网站帮忙推广的平台
  • 网站建设外包协议天津网站排名提升
  • 邯郸教育行业网站建设百度推广代理商查询
  • 政府网站有哪些网站seo最新优化方法
  • 做广告牌子seo外链工具
  • 微信页面设计网站兰州网络推广技术
  • 上门做网站搜狗站长工具
  • wordpress用户邮箱验证码百度seo搜索引擎优化培训
  • 360极速怎么屏蔽网站新闻热点大事件
  • 购物app开发价格表站长工具seo排名
  • 微餐饮网站建设营销型网站建设方案
  • 高端网站建设公司好不好2020国内搜索引擎排行榜