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

百度搜自己的网站商城app开发要多少钱

百度搜自己的网站,商城app开发要多少钱,网站最新程序策划书,wordpress 登依赖注入#xff08;Dependency Injection#xff09; 它是 Spring 框架核心 IOC 的具体实现。 在编写程序时#xff0c;通过控制反转#xff0c;把对象的创建交给了 Spring#xff0c;但是代码中不可能出现没有依赖的情况。 IOC 解耦只是降低他们的依赖关系#xff0c;…依赖注入Dependency Injection 它是 Spring 框架核心 IOC 的具体实现。 在编写程序时通过控制反转把对象的创建交给了 Spring但是代码中不可能出现没有依赖的情况。 IOC 解耦只是降低他们的依赖关系但不会消除。例如业务层仍会调用持久层的方法。 那这种业务层和持久层的依赖关系在使用 Spring 之后就让 Spring 来维护了。 简单的说就是坐等框架把持久层对象传入业务层而不用我们自己去获取 Bean的依赖注入方式 ①构造方法 创建有参构造 public class service {Dao dao;public service(Dao dao) {this.dao dao;}public service() {}public void save(){dao.save();}public static void main(String[] args) {ApplicationContext applicationContextnew ClassPathXmlApplicationContext(applicationContext.xml);service i(service) applicationContext.getBean(service);i.save();} }java ?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 idimpl classcom.ImplDao /bean idservice classcom.serviceconstructor-arg namedao refimpl//bean /beans②set方法 ?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 idimpl classcom.ImplDao /bean idservice classcom.serviceproperty namedao refimpl//bean /beanspublic class service {Dao dao;public service(Dao dao) {this.dao dao;}public service() {}public void save(){dao.save();}public void setDao(Dao dao) {this.dao dao;}public static void main(String[] args) {ApplicationContext applicationContextnew ClassPathXmlApplicationContext(applicationContext.xml);service i(service) applicationContext.getBean(service);i.save();} } set方法:P命名空间注入 P命名空间注入本质也是set方法注入但比起上述的set方法注入更加方便主要体现在配置文件中如下 首先需要引入P命名空间 xmlns:phttp://www.springframework.org/schema/pbean idimpl classcom.ImplDao /bean idservice classcom.service p:dao-refimpl/bean /beansBean的依赖注入的数据类型 1普通数据类型的注入 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idimpl classcom.ImplDao /bean idservice classcom.service p:dao-refimplproperty namename valueaaa /property nameno value15//bean /beanspublic class service {Dao dao;int no;String name;public void setNo(int no) {this.no no;}public void setName(String name) {this.name name;}public service(Dao dao) {this.dao dao;}public service() {}public void save(){dao.save();System.out.println(this.toString());}public void setDao(Dao dao) {this.dao dao;}public static void main(String[] args) {ApplicationContext applicationContextnew ClassPathXmlApplicationContext(applicationContext.xml);service i(service) applicationContext.getBean(service);i.save();} } 2集合数据类型List的注入 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idimpl classcom.ImplDao /bean idservice classcom.service p:dao-refimplproperty namename valueaaa /property nameno value15/property namelistlistvalueaaa/valuevalueaadasa/valuevaluesada/value/list/property/bean /beans4集合数据类型 MapString,ImplDao 的注入 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idimpl classcom.ImplDao /bean idimpl2 classcom.ImplDao /bean idservice classcom.service p:dao-refimplproperty namename valueaaa /property nameno value15/property namelistlistvalueaaa/valuevalueaadasa/valuevaluesada/value/list/propertyproperty namemapmapentry keyi1 value-refimpl/entry keyi2 value-refimpl2//map/property/bean /beans5集合数据类型Properties的注入 ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:phttp://www.springframework.org/schema/pxsi:schemaLocationhttp://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdbean idimpl classcom.ImplDao /bean idimpl2 classcom.ImplDao /bean idservice classcom.service p:dao-refimplproperty namename valueaaa /property nameno value15/property namelistlistvalueaaa/valuevalueaadasa/valuevaluesada/value/list/propertyproperty namemapmapentry keyi1 value-refimpl/entry keyi2 value-refimpl2//map/propertyproperty namepropertiespropsprop keyaa11/propprop keybb22/prop/props/property/bean /beans引入其他配置文件分模块开发 实际开发中Spring的配置内容非常多这就导致Spring配置很繁杂且体积很大所以可以将部分配置拆解到其 他配置文件中而在Spring主配置文件通过import标签进行加载 import resourceapplicationContext-dao.xml /
http://www.pierceye.com/news/455958/

相关文章:

  • 设计网络网站做国外网站 国外人能看到吗
  • 融安有那几个网站做的比较好的创建网站大约
  • 浙江联科网站建设选择宁波seo优化公司
  • 上海建站网络科技app营销策略有哪些
  • 怎么检查网站有没有被挂马知乎做笔记的网站
  • 温岭网站制作爱网站查询
  • 徐州学习网站建设影视公司组织架构
  • 怎么看别人的网站有没有做301蓝色扁平化企业网站
  • 郑州建站模板网络程序员
  • 健身顾问在哪些网站做推广北京网络推广外包公司排行
  • 天津网站开发工资水平建设网站如何写文案
  • 做a漫画在线观看网站注册个免费网站
  • 杭州网站设计网页长安东莞网站推广
  • 福州网站建设软件怎样上传自己的网站
  • wordpress手机站如何做wordpress 查询文章
  • 企业专业网站设计公wordpress打开慢
  • 网站制作方案怎么做青岛住房和城乡建设部网站
  • 织梦系统做的网站忘记登录密码百家 主题 wordpress
  • 营销推广软文婚纱摄影网站seo方案
  • 上海网站制作网站建设汶川县建设局网站
  • 东莞seo网站推广怎么做能够让网站流量大
  • 郑州网站建设做推广吗灰色关键词排名方法
  • 在线推广企业网站的方法有哪些网站推广到海外怎么做
  • 怎么用视频做网站首页php网站开发职位
  • 网站平台怎么做typecho跟wordpress
  • 网站建设找什么公司微网站建设流程
  • 如何制作数据库网站哔哩哔哩推广平台
  • 免费建立手机网站网站建设下载模板之后怎么修改
  • wordpress 网站暂停做社区生意的网站
  • 渭南做网站的公司商业网站后缀名