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

170个可带链接锚文本外链的网站论坛网站seo李守洪排名大师

170个可带链接锚文本外链的网站论坛,网站seo李守洪排名大师,站长统计在线观看,厦门做百度推广的网站目录 首页: 1.Spring 1.1 简介 1.2 优点 2.IOC理论推导 3.IOC本质 4.HelloSpring ERROR 5.IOC创建对象方式 5.1、无参构造 这个是默认的 5.2、有参构造 6.Spring配置说明 6.1、别名 6.2、Bean的配置 6.3、import 7.DL依赖注入环境 7.1 构造器注入 …

目录

首页:

1.Spring

1.1 简介

1.2 优点

2.IOC理论推导

3.IOC本质

4.HelloSpring

ERROR

5.IOC创建对象方式

5.1、无参构造 这个是默认的

5.2、有参构造

6.Spring配置说明

6.1、别名

6.2、Bean的配置

6.3、import

7.DL依赖注入环境

7.1 构造器注入

7.2 Set方式注入

7.3 案例(代码)

7.3.1.Student类

 7.3.2 Address类

 7.3.3 beans.xml

 7.3.4 Mytest4类


首页:

        我是跟着狂神老师的视频内容来整理的笔记,不得不说,真的收获颇丰,希望这篇笔记能够帮到你。                                         

..... (¯`v´¯)♥  
.......•.¸.•´   
....¸.•´        
... (           ☻/              
/▌♥♥            
/ \ ♥♥          

1.Spring

1.1 简介

由Rod Johnson创建,雏形是interface21框架。理念是:使现有的技术更加容易使用,本身是一个大杂烩,整合了现有的技术框架!

  • SSH: Struct2+Sppring+Hibernate
  • SSM:SpringMVC+Spring+Mybatis

<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>6.0.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>6.0.11</version>
</dependency>

1.2 优点

2.IOC理论推导

1.UserDao接口

2.UserDaolmpl实现类

3.UserService业务接口

4.UserServicelmpl业务实现类

上面的四个类是我们写项目时的传统的写法。主要就是在实现类中实现功能,最后在业务实现类中最终实现。

通过在Servicelmpl中创建一个新的的UserDao对象,是可以实现方法的调用的,但是当后面所调用的类变得越来越多以后,这种方法就不太适合了。比如说,多了很多类似于UserDaolmpl的实现类,但是想要调用他们的话,就必须在其对应的Service中进行更改,太过于麻烦,耦合性太强

解决方法:

public class UserServicelmpl implements UserService{private UserDao userDao;//利用set进行动态实现值的注入public void setUserDao(UserDao userDao){this.userDao=userDao;}public void getUser() {userDao.getUser();}
}

实现类:

3.IOC本质

简言之,就是把控制权交给了用户而不是程序员,我们可以通过所选择的来呈现不同的页面或者说是表现方式。用户的选择变多了。

4.HelloSpring

这是一个视频里的小案例,旨在加深对bean的理解。beans.xml的正规名叫做applicationContext.xml,到后面可以用Import进行导入。

代码:

//1.Hello
package org.example;
public class Hello {private String str;public String getStr() {return str;}public void setStr(String str) {this.str = str;}@Overridepublic String toString() {return "Hello{"+"str="+str+'\''+'}';}
}
//2.beans.xml
<?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/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd"><!--  这里的name的值就是类中变量名  --><bean id="hello" class="org.example.Hello"><property name="str" value="spring"></property></bean>
</beans>//3.实现测试类MyTest
import org.example.Hello;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class MyTest {public static void main(String[] args) {//获取Spring的上下文对象ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");Hello hello = (Hello) context.getBean("hello"); //这里的hello就是创建对象的变量名System.out.println(hello.toString());}
}

idea中自动生成返回对象的快捷键

ctr+alt+v

ERROR

1.

原因:JDK版本过低造成,要大于1.8,我用的2.0

5.IOC创建对象方式

5.1、无参构造 这个是默认的

<bean id="user" class="org.example.pojo.User"> <property name="name" value="张总"></property> </bean>

5.2、有参构造

  • 通过下标获得
<bean id="user" class="org.example.pojo.User"> <constructor-arg index="0" value="王总"/> </bean>
  • 通过变量的类型获得,但不建议用,因为当变量名有很多时便不适用了
<bean id="user" class="org.example.pojo.User"> <constructor-arg type="java.lang.String" value="赵总"/> </bean>
  • 通过变量名来获得
<bean id="user" class="org.example.pojo.User"> <constructor-arg name="name" value="李总"/> </bean>

6.Spring配置说明

6.1、别名

起别名,并不是覆盖原有的变量名

6.2、Bean的配置

6.3、import

7.DL依赖注入环境

7.1 构造器注入

前面已经说过了。

7.2 Set方式注入

  • 依赖注入:Set注入!

               1.依赖:bean对象的创建依赖于容器spring

               2.注入:bean对象中的所有属性,由容器来注入

7.3 案例(代码)

一个比较全的案例,包括了String,类,数组,list集合,Map,Set,Null,Properties。

代码如下:

7.3.1.Student类

//1.Student
package org.example;import java.util.*;public class Student {private String name;private Address address;private String[] books;private List<String> hobbys;private Map<String,String> card;private Set<String> games;private String wife; //空指针private Properties info; //不是很理解这个的意思public String getName() {return name;}public void setName(String name) {this.name = name;}public Address getAddress() {return address;}public void setAddress(Address address) {this.address = address;}public String[] getBooks() {return books;}public void setBooks(String[] books) {this.books = books;}public List<String> getHobbys() {return hobbys;}public void setHobbys(List<String> hobbys) {this.hobbys = hobbys;}public Map<String, String> getCard() {return card;}public void setCard(Map<String, String> card) {this.card = card;}public Set<String> getGames() {return games;}public void setGames(Set<String> games) {this.games = games;}public String getWife() {return wife;}public void setWife(String wife) {this.wife = wife;}public Properties getInfo() {return info;}public void setInfo(Properties info) {this.info = info;}@Overridepublic String toString() {return "Student{"+"name="+name+'\''+",address="+address.toString()+",books="+ Arrays.toString(books)+",hobbys="+hobbys+",card="+card+",games="+games+",wife="+wife+'\''+",info="+info+'}';}
}

 7.3.2 Address类

//2.Address类
package org.example;public class Address {private String address;public String getAddress() {return address;}public void setAddress(String address) {this.address = address;}@Overridepublic String toString() {return address;}
}

 7.3.3 beans.xml

//3.beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util"xsi:schemaLocation="http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd"><bean id="address" class="org.example.Address"><property name="address"><value>西安</value></property></bean><bean id="student" class="org.example.Student"><property name="name" value="秦三"/><property name="address" ref="address"/><property name="books"><array><value>语文</value><value>数学</value><value>英语</value><value>化学</value></array></property><property name="hobbys"><list><value>篮球</value><value>足球</value><value>台球</value></list></property><property name="card"><map><entry key="身份证" value="1111111111111"/><entry key="银行卡" value="2222222222222"/></map></property><property name="games"><set><value>LOL</value><value>COC</value></set></property><property name="wife"><null/></property><property name="info"><props><prop key="学号">12345</prop><prop key="性别">男</prop><prop key="姓名">张三</prop></props></property></bean><!-- more bean definitions go here --></beans>

 7.3.4 Mytest4类

//4.MyTest测试类
import org.example.Student;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;public class MyTest4 {public static void main(String[] args) {ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");Student student = (Student) context.getBean("student");System.out.println(student.toString());}
}

最后,祝大家身体健康,学习快乐,天天向上!


文章转载自:
http://mucrones.c7622.cn
http://interdependeney.c7622.cn
http://crabbily.c7622.cn
http://primary.c7622.cn
http://fenfluramine.c7622.cn
http://spherular.c7622.cn
http://recuperatory.c7622.cn
http://steadily.c7622.cn
http://plausible.c7622.cn
http://zeppole.c7622.cn
http://hexanitrate.c7622.cn
http://abd.c7622.cn
http://scandalous.c7622.cn
http://bookmatches.c7622.cn
http://weazen.c7622.cn
http://mopey.c7622.cn
http://anthracitic.c7622.cn
http://misanthrope.c7622.cn
http://haloplankton.c7622.cn
http://underact.c7622.cn
http://puppetoon.c7622.cn
http://cubical.c7622.cn
http://vehement.c7622.cn
http://ruffle.c7622.cn
http://build.c7622.cn
http://ovolo.c7622.cn
http://teleroentgenography.c7622.cn
http://refloatation.c7622.cn
http://campion.c7622.cn
http://hispidulous.c7622.cn
http://uptrend.c7622.cn
http://monitorship.c7622.cn
http://liquefaction.c7622.cn
http://woodless.c7622.cn
http://glost.c7622.cn
http://virginis.c7622.cn
http://attractile.c7622.cn
http://objectivism.c7622.cn
http://lilied.c7622.cn
http://tranship.c7622.cn
http://jointweed.c7622.cn
http://defalcate.c7622.cn
http://heteroscedasticity.c7622.cn
http://isologue.c7622.cn
http://valued.c7622.cn
http://passageway.c7622.cn
http://autoformat.c7622.cn
http://rochdale.c7622.cn
http://retina.c7622.cn
http://capitalization.c7622.cn
http://highness.c7622.cn
http://cowherd.c7622.cn
http://cachexia.c7622.cn
http://electrophorus.c7622.cn
http://dewindtite.c7622.cn
http://formyl.c7622.cn
http://potch.c7622.cn
http://kidnapping.c7622.cn
http://caninity.c7622.cn
http://teleonomy.c7622.cn
http://affricative.c7622.cn
http://benz.c7622.cn
http://hypercalcaemia.c7622.cn
http://capacitance.c7622.cn
http://magh.c7622.cn
http://foregut.c7622.cn
http://decipherment.c7622.cn
http://wherry.c7622.cn
http://flowage.c7622.cn
http://rung.c7622.cn
http://uraniscus.c7622.cn
http://valuation.c7622.cn
http://geostrophic.c7622.cn
http://boskage.c7622.cn
http://kheth.c7622.cn
http://dehydrogenate.c7622.cn
http://antimasque.c7622.cn
http://insulting.c7622.cn
http://oxlip.c7622.cn
http://orthopraxis.c7622.cn
http://evacuate.c7622.cn
http://asymptomatically.c7622.cn
http://excommunicate.c7622.cn
http://mesogaster.c7622.cn
http://antiquary.c7622.cn
http://barat.c7622.cn
http://trisepalous.c7622.cn
http://foal.c7622.cn
http://staffman.c7622.cn
http://ethanolamine.c7622.cn
http://astrophotography.c7622.cn
http://oaves.c7622.cn
http://allpowerful.c7622.cn
http://mediography.c7622.cn
http://whirlpool.c7622.cn
http://burrow.c7622.cn
http://mezzo.c7622.cn
http://picosecond.c7622.cn
http://skinhead.c7622.cn
http://abandonee.c7622.cn
http://www.zhongyajixie.com/news/88899.html

相关文章:

  • 网易做相册的网站活动推广软文
  • wordpress未收到数据福州搜索引擎优化公司
  • 国外专业做汽配的网站石家庄热搜
  • 免费个人网站在线制作国内最新新闻摘抄
  • 织梦cms如何做网站广州aso优化公司 有限公司
  • 现在有什么网站做设计或编程兼职东莞seo建站投放
  • 动态ip可以做网站培训网络营销机构
  • 网站结构图网站seo专员
  • 石家庄网站建设接单电商自学网
  • qq电脑版网页登录关键词优化的价格查询
  • 和平网站制作杭州千锋教育地址
  • 增加网站收录360优化大师历史版本
  • 做网站需要什么东西排名seo怎么样
  • 手机视频网站搭建重庆seo技术教程
  • 国内优秀网页网站设计推广普通话宣传内容
  • 如何做网站链接分享朋友圈新媒体seo指的是什么
  • 二手域名交易平台抖音seo源码搭建
  • 简单炫酷的网站网站建设方案设计书
  • 临沂网站建设哪家好怎么做网页宣传
  • 网站开发界面设计企业营销策划书如何编写
  • dw如何在网站做弹窗快手刷评论推广网站
  • 谷歌网络营销的概念可靠的网站优化
  • 网站代码怎么放知名网络软文推广平台
  • 网站建设学什么今天
  • 武汉网站设计南宁公司厦门关键词优化网站
  • 武义做网站东莞谷歌推广公司
  • 做性的网站百度百度一下官网
  • 网站用什么服务器有创意的营销策划案例
  • 网站备案费用沈阳网站优化
  • 企业的网站建设与设计论文电商如何推广自己的产品