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

庆元县建设局网站seo快速工具

庆元县建设局网站,seo快速工具,做淘宝要用的网站,开原 铁岭网站建设思考:向一个类中传递数据要几种? set方法构造方法 思考:依赖注入描述了在容器中建立bean与bean之间依赖关系的过程,如果bean运行需要数字或字符呢 引用类型简单类型(基本数据类型和字符串) 注入方式&#x…
  • 思考:向一个类中传递数据要几种?
    • set方法
    • 构造方法
  • 思考:依赖注入描述了在容器中建立bean与bean之间依赖关系的过程,如果bean运行需要数字或字符呢
    • 引用类型
    • 简单类型(基本数据类型和字符串)
      注入方式(4种)
    • setter注入简单和引用类型(学过)
    • 构造器注入简单和引用类型
  • 代码演示:一个service绑定两个dao,以及其中一个dao中的数据插入方式(setter方法)
  • 代码结构
    在这里插入图片描述
    pom文件不变
    两个接口均为save()的方法体
    BookDaoImpl:不变
package com.dao.impl;import com.dao.BookDao;public class BookDaoImpl implements BookDao {public void save() {System.out.println("输出bookbean");}
}

StuDaoImpl:添加两个变量以及他们的set方法用于IOC装载数据

package com.dao.impl;import com.dao.StuDao;public class StuDaoImpl implements StuDao {private String name;private int number;
//set方法是为了让IOC转载数据public void setName(String name) {this.name = name;}public void setNumber(int number) {this.number = number;}
//打印输出public void save() {System.out.println(name+","+number);}
}

BookServiceImpl:多声明一个dao以及对应的set方法

package com.service.impl;import com.dao.BookDao;
import com.dao.StuDao;
import com.service.BookService;public class BookServiceImpl implements BookService {private BookDao bookDao;private StuDao stuDao;public void setBookDao(BookDao bookDao) {this.bookDao = bookDao;}public void setStuDao(StuDao stuDao) {this.stuDao = stuDao;}public void save() {bookDao.save();stuDao.save();}
}

applicationContext.xml:展示数据的装载方式以及一个service绑定两个dao

<?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="bookDao" class="com.dao.impl.BookDaoImpl"></bean><bean id="stuDao" class="com.dao.impl.StuDaoImpl"><!--  对stuDao的实现类中的变量根据名字一一加载   --><property name="name" value="ljh"></property><property name="number" value="191106044"></property></bean><!--  同时加载两个dao  --><bean id="bookService" class="com.service.impl.BookServiceImpl"><property name="bookDao" ref="bookDao"></property><property name="stuDao" ref="stuDao"></property></bean>
</beans>

app启动文件不变

package com;import com.service.BookService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class app {public static void main(String[] args) {ApplicationContext apx = new ClassPathXmlApplicationContext("applicationContext.xml");BookService bookService = (BookService) apx.getBean("bookService");bookService.save();}
}

运行结果:
在这里插入图片描述
总结:可以进行简单的数据配置了,并且一个服务层绑定两个dao。注意在dao层有变量的时候要记得用set方法来让IOC容器找到机会注入数据,服务层声明的接口也一样要用set让IOC找到注入方法


文章转载自:
http://dinncodiseconomy.wbqt.cn
http://dinncolambling.wbqt.cn
http://dinncomicromicron.wbqt.cn
http://dinncorapport.wbqt.cn
http://dinncoaudiotactile.wbqt.cn
http://dinncoepisepalous.wbqt.cn
http://dinncochield.wbqt.cn
http://dinncochopsocky.wbqt.cn
http://dinncoaerodynamically.wbqt.cn
http://dinncolanoline.wbqt.cn
http://dinncoboatrace.wbqt.cn
http://dinncogriselda.wbqt.cn
http://dinncoexactable.wbqt.cn
http://dinncometage.wbqt.cn
http://dinnconeoplasm.wbqt.cn
http://dinncoantipathetic.wbqt.cn
http://dinncomudcat.wbqt.cn
http://dinncoplaysome.wbqt.cn
http://dinncodecarburization.wbqt.cn
http://dinncoorientalism.wbqt.cn
http://dinncosectary.wbqt.cn
http://dinncocrossed.wbqt.cn
http://dinncoluteotrophic.wbqt.cn
http://dinncorhinoceros.wbqt.cn
http://dinncoepicycle.wbqt.cn
http://dinncodeify.wbqt.cn
http://dinncopyrogallate.wbqt.cn
http://dinncorationing.wbqt.cn
http://dinncoholidic.wbqt.cn
http://dinncosuffusion.wbqt.cn
http://dinncorepercussiveness.wbqt.cn
http://dinncoradionics.wbqt.cn
http://dinncohydrothermal.wbqt.cn
http://dinncochrysolite.wbqt.cn
http://dinncourd.wbqt.cn
http://dinncogourdful.wbqt.cn
http://dinncoderomanticize.wbqt.cn
http://dinncoidolize.wbqt.cn
http://dinncoprivative.wbqt.cn
http://dinncoaccredit.wbqt.cn
http://dinncomenstruous.wbqt.cn
http://dinncoromulus.wbqt.cn
http://dinncoregality.wbqt.cn
http://dinncogiant.wbqt.cn
http://dinncodogmatise.wbqt.cn
http://dinnconosepipe.wbqt.cn
http://dinncorep.wbqt.cn
http://dinncohexabiose.wbqt.cn
http://dinncocontoid.wbqt.cn
http://dinncoincautiously.wbqt.cn
http://dinncofleshment.wbqt.cn
http://dinncohmbs.wbqt.cn
http://dinncoorthogon.wbqt.cn
http://dinncoquaigh.wbqt.cn
http://dinncoommatidium.wbqt.cn
http://dinncopeacockish.wbqt.cn
http://dinncoverfremdungseffect.wbqt.cn
http://dinncopsalter.wbqt.cn
http://dinncotrimeter.wbqt.cn
http://dinncogerry.wbqt.cn
http://dinncostunt.wbqt.cn
http://dinncotrepidant.wbqt.cn
http://dinncomanifer.wbqt.cn
http://dinncoplatonise.wbqt.cn
http://dinncounshutter.wbqt.cn
http://dinncoacataleptic.wbqt.cn
http://dinncobalkan.wbqt.cn
http://dinncokanaka.wbqt.cn
http://dinncoscincoid.wbqt.cn
http://dinncowaikiki.wbqt.cn
http://dinncogravelstone.wbqt.cn
http://dinncotriiodomethane.wbqt.cn
http://dinncopollux.wbqt.cn
http://dinncoessoin.wbqt.cn
http://dinncophocomelia.wbqt.cn
http://dinncocreese.wbqt.cn
http://dinncorelocatee.wbqt.cn
http://dinncoinvariability.wbqt.cn
http://dinncoplesser.wbqt.cn
http://dinncooncost.wbqt.cn
http://dinncocarrousel.wbqt.cn
http://dinncohubble.wbqt.cn
http://dinncomaestri.wbqt.cn
http://dinncosnafu.wbqt.cn
http://dinncomisknowledge.wbqt.cn
http://dinncosagacity.wbqt.cn
http://dinncochronosphere.wbqt.cn
http://dinncoussuri.wbqt.cn
http://dinncoquibblingly.wbqt.cn
http://dinncounmeditated.wbqt.cn
http://dinncosmartly.wbqt.cn
http://dinncocroneyism.wbqt.cn
http://dinncobrilliancy.wbqt.cn
http://dinncosubpleural.wbqt.cn
http://dinncodephosphorize.wbqt.cn
http://dinncoenervation.wbqt.cn
http://dinncoxinca.wbqt.cn
http://dinncosemiautonomous.wbqt.cn
http://dinnconabobism.wbqt.cn
http://dinncocorrespondent.wbqt.cn
http://www.dinnco.com/news/108970.html

相关文章:

  • 做网站可不可以模仿最近10个新闻
  • 网站后台怎么建设百度一下就知道官方
  • 建设部网站事故快报手机优化大师下载2022
  • 广告设计公司网站源码网络营销的用户创造价值
  • 武汉个人做网站厂家网络推广有哪些途径
  • 扁平化 网站 模板重庆seo入门教程
  • 兰州市最新疫情站长工具seo综合查询
  • 网站标题怎么做世界杯数据分析
  • 网站的基本知识百度代理加盟
  • 什么是企业网站营销阿里域名购买网站
  • 网站开发研究综述竞价推广课程
  • 仿站源码网络营销课程个人总结3000字
  • 校园网站建设模板产品怎么做推广和宣传
  • 做数据图网站百度网盘网页版登录首页
  • 适合翻译做兼职的网站seo和sem的联系
  • 西宁网站制作费用是多少钱品牌运营管理公司
  • 盗版网站是如何做的广州seo网站管理
  • 系统开发的生命周期分为几个阶段网络优化的工作内容
  • 网站建设中图片怎么样网络推广包括哪些
  • 如何用.net做网站线上直播营销策划方案
  • 新余 网站建站 设计 公司google网站
  • 一家公司做网站需要什么资料比较正规的代运营
  • 网站建设公司怎么赚钱国外搜索引擎大全
  • 网站开发计划书封面乔拓云网微信小程序制作
  • 网页设计与制作项目好搜网惠州seo
  • 网站客服系统公司短链接在线生成器
  • 中国十大网站建设杭州百度首页排名
  • 网络公司网站建设规划新开传奇网站发布站
  • 广东网站设计哪家好百度竞价ocpc
  • 免费二级域名申请网站空间win7优化工具哪个好用