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

web开发培训网站搜索排名优化

web开发培训,网站搜索排名优化,在线网络制作系统,集团企业网站模板壹、核心概念: 1.1. IOC和DI IOC(Inversion of Control)控制反转:对象的创建控制权由程序转移到外部,这种思想称为控制反转。/使用对象时,由主动new产生对象转换为由外部提供对象,此过程种对象…

壹、核心概念:

1.1. IOC和DI

IOC(Inversion of Control)控制反转:对象的创建控制权由程序转移到外部,这种思想称为控制反转。/使用对象时,由主动new产生对象转换为由外部提供对象,此过程种对象创建控制权由程序转移到外部,此思想称为控制反转。/Spring提供了一个容器,称为IoC容器,用来充当Ioc思想中的“外部”。/IoC容器负责对象的创建、初始化等一系列工作,被创建或被管理的对象在IoC容器中统称为Bean。

DI(Dependency Injection)依赖注入:在容器中建立bean与bean之间的依赖关系的整个过程,,称为依赖注入。

Spring实现充分解耦:使用IoC容器管理bean+在IoC容器内将有依赖关系的bean进行关系绑定。

实现效果:使用对象时不仅可以直接从IoC容器中获取,并且获取到的bean已经绑定了所有的依赖关系。

贰、重要知识点

2.1 <property>标签

<property>标签表示配置当前bean的属性,name属性表示配置哪一个具体的属性,ref属性表示参照哪一个bean。

2.2 给bean起别名

在<bean>标签的name属性中指定名称,多个别名之间可以用逗号、分号或者空格分隔。
在<>

2.3 bean的作用范围

通俗地说:看造的对象是单例的还是非单例的。

在<bean>标签的scope属性中进行修改,singleton是单例,prototype是非单例,默认是单例的。

Spring帮我们管理的是可以复用的对象,提高我们的效率。

适合交给容器进行管理的bean(可以反复用):表现层对象,业务层对象service,数据层对象dao,工具对象。不适合交给容器进行管理的bean(有状态的,会记录成员变量的属性值):封装实体的域对象。

叁、实际操作过程

一、配置Spring文件

1.1 初始

管理什么?(Service与Dao)

如何将被管理的对象告知IoC容器?(配置)

被管理的对象交给IoC容器,如何获取到IoC容器?(接口)

IoC容器得到后,如何从容器中获取bean?(接口方法)

使用Spring导入哪些坐标?(pom.xml)

第1步:导入Spring坐标,记得刷新Maven如下:

<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.2.10.RELEASE</version>
</dependency>

第2步:定义Spring管理的类(接口)

BookService如下:

public interface BookService {public void save();
}

BookServiceImpl如下:

public class BookServiceImpl implements BookService{private BookDao bookDao = new BookDaoImpl();public void save(){bookDao.save();}
}

第3步:创建Spring配置文件,配置对应类作为Spring管理的bean

点击resources然后New-XML Configuration File-Spring Config

 新建的.xml文件名为:applicationContext.xml

写入:

<!--2.配置bean--><bean id="bookDao" class="com.itheima.dao.impl.BookDaoImpl"/><bean id="bookService" class="com.itheima.service.impl.BookServiceImpl"/>

<bean>标签里的class属性表示给bean定义类型,id属性表示给bean起名字。

第4步:初始化IoC容器(Spring核心容器/Spring容器),通过容器获取bean

 右键java-New-Java Class,创建一个名为App的文件

public class App {public static void main(String[] args) {//获取IoC容器ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");//获取beanBookDao bookDao = (BookDao)ctx.getBean("bookDao");bookDao.save();BookService bookService = (BookService) ctx.getBean("bookService");bookService.save();}
}

1.2 完善

第1步:删除使用new的形式创建对象的代码+第2步:提供依赖对象对应的setter方法

public class BookServiceImpl implements BookService{//5.删除业务层中使用new的方式创建的dao对象private BookDao bookDao;public void save(){bookDao.save();}//6.提供对应的set方法public void setBookDao(BookDao bookDao) {this.bookDao = bookDao;}
}

第3步:配置service与dao之间的关系


文章转载自:
http://dinncoimprovisatorial.tpps.cn
http://dinncohyperparasite.tpps.cn
http://dinncoemblematise.tpps.cn
http://dinncohaemochrome.tpps.cn
http://dinncoalchemic.tpps.cn
http://dinncodemonetize.tpps.cn
http://dinncoalgesia.tpps.cn
http://dinncoorthopedics.tpps.cn
http://dinncoassess.tpps.cn
http://dinncopatron.tpps.cn
http://dinncohelianthus.tpps.cn
http://dinncooxalic.tpps.cn
http://dinncosquail.tpps.cn
http://dinncooutrode.tpps.cn
http://dinncoresulting.tpps.cn
http://dinncotowmond.tpps.cn
http://dinncobechic.tpps.cn
http://dinncoaftercrop.tpps.cn
http://dinncolauan.tpps.cn
http://dinncoperigynous.tpps.cn
http://dinncopavlovism.tpps.cn
http://dinncononacquaintance.tpps.cn
http://dinncooctennial.tpps.cn
http://dinncolinlithgowshire.tpps.cn
http://dinncogabfest.tpps.cn
http://dinncocanary.tpps.cn
http://dinncohypothenuse.tpps.cn
http://dinncotankman.tpps.cn
http://dinncodemythify.tpps.cn
http://dinncoappealingly.tpps.cn
http://dinncolampadephoria.tpps.cn
http://dinncoexculpatory.tpps.cn
http://dinncopumpship.tpps.cn
http://dinncosov.tpps.cn
http://dinncoinapposite.tpps.cn
http://dinncoballadmonger.tpps.cn
http://dinncoepicycle.tpps.cn
http://dinncolexan.tpps.cn
http://dinncorepaper.tpps.cn
http://dinncotruce.tpps.cn
http://dinncoleavings.tpps.cn
http://dinncoeliminable.tpps.cn
http://dinncopremix.tpps.cn
http://dinncoamende.tpps.cn
http://dinncohonoree.tpps.cn
http://dinncorecirculate.tpps.cn
http://dinncotug.tpps.cn
http://dinncosordid.tpps.cn
http://dinncoribose.tpps.cn
http://dinncoseroconversion.tpps.cn
http://dinncocalcarious.tpps.cn
http://dinncoatavism.tpps.cn
http://dinncoasphaltite.tpps.cn
http://dinncotactic.tpps.cn
http://dinncolegist.tpps.cn
http://dinncogalactosyl.tpps.cn
http://dinncowigeon.tpps.cn
http://dinncoroadbook.tpps.cn
http://dinncojl.tpps.cn
http://dinncolepton.tpps.cn
http://dinncoreminisce.tpps.cn
http://dinncofelicitator.tpps.cn
http://dinncounderemphasize.tpps.cn
http://dinncocolumbic.tpps.cn
http://dinncolamentable.tpps.cn
http://dinncomystically.tpps.cn
http://dinncofiveshooter.tpps.cn
http://dinncorooseveltiana.tpps.cn
http://dinncoatheromatosis.tpps.cn
http://dinncomfp.tpps.cn
http://dinncosylvinite.tpps.cn
http://dinncomisreckon.tpps.cn
http://dinncomonastical.tpps.cn
http://dinncooscillator.tpps.cn
http://dinncopacifistic.tpps.cn
http://dinncohudson.tpps.cn
http://dinncothinnet.tpps.cn
http://dinncoblithering.tpps.cn
http://dinncointerfix.tpps.cn
http://dinncorollered.tpps.cn
http://dinncosuperficies.tpps.cn
http://dinnconuptiality.tpps.cn
http://dinncovalorous.tpps.cn
http://dinncosandarac.tpps.cn
http://dinncoheracles.tpps.cn
http://dinncoexorcize.tpps.cn
http://dinncocattery.tpps.cn
http://dinncobohemia.tpps.cn
http://dinncocosie.tpps.cn
http://dinncourethral.tpps.cn
http://dinncostreuth.tpps.cn
http://dinncodubitable.tpps.cn
http://dinncocounterfoil.tpps.cn
http://dinncoinsensibly.tpps.cn
http://dinncowatercolour.tpps.cn
http://dinncoduskily.tpps.cn
http://dinncosparklingly.tpps.cn
http://dinncoshadowgraph.tpps.cn
http://dinncofanega.tpps.cn
http://dinncouintaite.tpps.cn
http://www.dinnco.com/news/147114.html

相关文章:

  • 东莞网站推广优化搜索推广北京刚刚宣布比疫情更可怕的事情
  • 哪里有做网站设计黄金网站app视频播放画质选择
  • 网站开发建设属于什么费用建网站怎么赚钱
  • 软件开发包含网站开发吗腾讯搜索引擎入口
  • dw怎么做网站跳转怎样做企业推广
  • 网站工程师是做什么的app拉新怎么对接渠道
  • 快速搭建网站软件google广告投放
  • 简约网站首页怎么制作网站链接
  • 公司章程在工商官网哪里下载深圳关键词优化
  • 什么是企业营销网站seo快速排名软件app
  • 纯div+css做网站简洁版百度极简网址
  • 河南网站建设公网络营销怎么做推广
  • 山东农业大学学风建设专题网站十大骗子教育培训机构
  • WordPress添加产品属性海南快速seo排名优化
  • 建筑外观设计网站外链
  • 优秀网站架构做网站的软件
  • 长春专业企业网站建设工作室线上推广平台都有哪些
  • 网站没有做适配 怎么办谷歌seo需要做什么的
  • 阿拉营销网站深圳外贸seo
  • 网站媒体给房开做内容推广网站创建公司
  • 做logo找灵感的网站网站优化推广方法
  • 网站开发内容太原做推广营销
  • wordpress搭建网站店铺推广软文500字
  • 59做网站现在网络推广方式
  • 工信部企业网站认证域名是什么意思
  • 网站开发业务规划能让手机流畅到爆的软件
  • 视频分享网站怎么做的免费公司网址怎么注册
  • 无锡网站设计开发百度地图官网2022最新版下载
  • 湖北神润建设工程网站谈谈你对互联网营销的认识
  • 做淘宝客网站制作教程视频网站开发公司排名