一、后端開發(fā)的概念和技術(shù)棧
1.1 什么是后端開發(fā)恬惯?
https://zhuanlan.zhihu.com/p/27067255
1.2 java后端技術(shù)圖譜
二、javaEE概念
Java EE亚茬,Java 平臺(tái)企業(yè)版(Java Platform Enterprise Edition)酪耳,之前稱為Java 2 Platform, Enterprise Edition (J2EE),2018年3月更名為 Jakarta EE(這個(gè)名稱應(yīng)該還沒有得到群眾認(rèn)可)刹缝。是 Sun 公司為企業(yè)級(jí)應(yīng)用推出的標(biāo)準(zhǔn)平臺(tái)碗暗,用來開發(fā)B/S架構(gòu)軟件奖蔓。Java EE 可以說是一個(gè)框架,也可以說是一種規(guī)范讹堤。
三、JavaWeb需要掌握什么厨疙?
- 網(wǎng)絡(luò)通信協(xié)議:http
- 服務(wù)器:tomcat(開源),jetty(嵌入式),weblogic(商用),ngix(靜態(tài)),apache(靜態(tài))
- 云服務(wù)器:阿里云洲守、騰訊云
- servlet,過濾器,監(jiān)聽器
- 其他:緩存、日志沾凄、git梗醇、maven、跨域撒蟀、負(fù)載均衡
四叙谨、Spring框架特點(diǎn)及構(gòu)成
4.1 Spring化繁為簡(jiǎn)主要的表現(xiàn)為以下幾個(gè)方面。
- 輕量級(jí)IoC容器保屯。
- 采用AOP編程方式手负。
- 大量使用批注。
- 避免重復(fù)“造輪子”姑尺,減少代碼的重復(fù)性竟终。
4.2 構(gòu)成
- Spring Core:核心容器,BeanFactory提供了組件生命周期的管理切蟋,組件的創(chuàng)建统捶,裝配,銷毀等功能
- SpringContext:ApplicationContext柄粹,擴(kuò)展核心容器喘鸟,提供事件處理、國(guó)際化等功能驻右。它提供了一些企業(yè)級(jí)服務(wù)的功能什黑,提供了JNDI,EJB堪夭,RMI的支持兑凿。
- Spring AOP:提供切面支持
- Spring DAO:提供事務(wù)支持,JDBC茵瘾,DAO支持
- Spring ORM:對(duì)流行的O/R Mapping封裝或支持
- Spring Web:提供Web應(yīng)用上下文礼华,對(duì)Web開發(fā)提供功能上的支持,如請(qǐng)求拗秘,表單圣絮,異常等。
- Spring Web MVC:全功能MVC框架雕旨,作用等同于Struts扮匠。
Spring的起步練習(xí)步驟
- 下載maven
- 如何使用idea配置maven
- 新建項(xiàng)目helloworld(注意項(xiàng)目名字不要大寫)
- 添加依賴包
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.0.10.RELEASE</version>
</dependency>
</dependencies>
- 新建helloworld類
public class helloworld {
public String getHello(){
return "hello world";
}
}
- 配置beans.xml
<bean id="helloworld" class="com.soft1721.spring.hello.helloworld"/>
- 編寫helloworldApp
public static void main(String[] args) {
// 讀入xml文件
ApplicationContext context=new ClassPathXmlApplicationContext("/beans.xml");
// 讀取配置好的bean
helloworld helloworld= (com.soft1721.spring.hello.helloworld) context.getBean("helloworld");
// 運(yùn)行helloworld方法
System.out.println(helloworld.getHello());
}
- 傳入?yún)?shù)
<bean id="phone" class="com.soft1721.spring.hello.Phone">
<constructor-arg name="grand" value="小米"/>
<constructor-arg name="price" value="2999"/>
<constructor-arg name="size" value="6.4"/>
</bean>
<bean id="student" class="com.soft1721.spring.hello.student">
<property name="age" value="24"/>
<property name="name" value="Tomy"/>
<property name="phone" ref="phone"/>
</bean>
constructor-arg用于數(shù)據(jù)類型不是一般數(shù)據(jù)類型時(shí)捧请,property用于一般數(shù)據(jù)類型適用范圍較廣