当前位置:网站首页>知识点总结
知识点总结
2022-06-26 18:20:00 【[email protected]】
1.知识小结
1.1 Mysql
版本说明: 最好不要使用mysql8.0 建议使用mariadb 10以上
下载地址: https://mariadb.org/download/?rel=10.6.4&prod=mariadb&os=windows&cpu=x86_64&pkg=msi&mirror=ossplanet
基本功能 CRUD操作。
连接方式: 左连接,右连接,内连接
1.2 JDBC
功能和作用: java中操作数据库中最为直接的方式。
表述: JDBC开发效率高? 开发效率低
JDBC运行效率高? 操作数据库最快的就是JDBC
1.3 前端
核心知识:
1.html
2.javascript JS 学一学
3.CSS 美化
4、Ajax
前端的内容属于静态页面。
动态页面: JSP html + java代码 tomcat负责解析。
1.4 框架说明
SpringBoot 核心是Spring,简化框架的开发
理解:SpringBoot是框架的框架
SpringMVC 理念: 主要负责实现前后端交互.
媒介: http(不安全)/https(安全) 秘钥:证书(公钥私钥) 协议
TCP/IP协议 (3次握手规则) 速度是很快的
常用工具: Ajax
Spring框架
主要作用: 主要整合第三方框架,使得程序可以以一种统一的方式进行管理.
概念:
1. 控制反转/依赖注入 IOC/DI
2. 面向切面编程 AOP(1-2年)
2. IDEA环境配置
2.1 准备工作目录
说明: 整合第三阶段的代码都统一的放到目录cgb2108中, 该目录不要与其它的软件耦合.
程序员操守: 1.路径中不要有中文/空格/特殊字符
2.软件目录结构不要与其它软件耦合!!!
3.找一个趁手的文本编辑器 EverEdit.exe
2.2 IDEA环境配置
具体步骤 参见资料PPT
2.3 maven配置
2.3.1 Maven介绍
Maven项目对象模型(POM),可以通过一小段描述信息来管理项目的构建,报告和文档的项目管理工具软件。
Maven 除了以程序构建能力为特色之外,还提供高级项目管理工具。由于 Maven 的缺省构建规则有较高的可重用性,所以常常用两三行 Maven 构建脚本就可以构建简单的项目。由于 Maven 的面向项目的方法,许多 Apache Jakarta 项目发文时使用 Maven,而且公司项目采用 Maven 的比例在持续增长。
2.3.2 Maven下载
2.3.3 Maven工作原理
1.用户使用的jar包都来源于本地库.
2.本地库中的jar包 来源于私服镜像和远程服务器.
2.3.4 Maven Settings 文件
配置本地仓库位置
<localRepository>E:/project3/repo</localRepository>
配置私服镜像
<mirror>
<id>aliyun</id>
<name>aliyun for maven</name>
<mirrorOf>*</mirrorOf>
<url>https://maven.aliyun.com/repository/public</url>
</mirror>
旧版本eclipse的配置
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>
1.8
</maven.compiler.compilerVersion>
</properties>
</profile>
2.3.5 IDEA 整合Maven
2.4 SpringBoot入门案例
2.4.1 选择镜像地址
2.4.2 编辑项目配置
2.4.3 编辑选择springboot版本
说明:
1.选择springboot版本 2.3.7
2.勾选 Spring Web
3 SpringBoot高级用法
3.1 maven坐标说明
3.1.1 maven坐标作用
maven的坐标主要标识项目,并且标识 唯一标识.
maven项目操作时,与本地仓库一一对应.
<!--组ID-->
<groupId>com.jt</groupId>
<!--项目名称-->
<artifactId>springboot_demo1</artifactId>
<!--版本号-->
<version>0.0.1-SNAPSHOT</version>
3.1.2 maven 命令
clean 清空项目中的target文件目录的. xxx.class文件信息
install 将项目打包处理
install详细说明:
每次打包 会在2个位置生成jar包文件.
位置1: target文件目录中.
位置2: 根据坐标,在本地仓库中生成具体的jar包文件,该文件可以被其它项目依赖.
3.1.3 打包类型
jar包文件 springboot项目/工具API项目/框架的项目
war包文件 动态web项目 JSP类型 tomcat服务器.
pom类型(标识符) POM类型表示聚合工程 微服务架构设计一般采用pom类型.
3.1.4 关于Maven 下载说明
说明: 根据坐标可以在本地仓库的指定位置 查找到jar包文件
作用: 可以被其它项目依赖
3.1.5 maven jar包依赖的传递性
案例说明1: 用户只需要引入特定的jar包文件,则maven可以通过依赖的传递性,实现其它jar包文件的引入.
数据结构说明:
A.jar 依赖 B.jar, B.jar 依赖 C.jar 如果只导入A.jar 则自动依赖B/C
3.1.5.1 Jar传递性的实现原理
实现原理:
1. 当maven扫描依赖信息时,会根据坐标找到对应的jar包文件.
2. 之后扫描当前目录下的xxx.pom文件
3. 根据pom文件中的依赖项dependency 再次查找其它的依赖jar包,直到所有jar包依赖完成为止.
3.1.5.2 jar包传递安全性问题(扩展知识)
问题: jar包文件都是通过网络下载而来的,如何保证文件不被篡改???
3.1.5.3 sha1算法介绍
SHA-1(英语:Secure Hash Algorithm 1,中文名:安全散列算法1)是一种密码散列函数,美国国家安全局设计,并由美国国家标准技术研究所(NIST)发布为联邦数据处理标准(FIPS)。SHA-1可以生成一个被称为消息摘要的160位(20字节)散列值,散列值通常的呈现形式为40个十六进制数。
3.1.5.4 关于hash基本常识
如果数据相同,相同的hash算法 问 hash值是否相同?? 必定相同!!!
如果数据不同,相同的hash算法 问hash值是否相同?? 可能相同!!!
(hash碰撞)
常见hash 一般 8位16进制数组成
3.1.5.5 工作原理
说明: 对原始数据进行hash计算 得到摘要信息, 获得数据时 采用hash计算 比较2个的摘要信息,如果相同则数据相同,如果不同则数据必然被篡改.
3.2 关于项目依赖项
3.2.1 关于Springboot版本管理说明
说明: spring-boot-dependencies 是SpringBoot官网进行调试之后,将所有的关联的jar包进行了定义.从根本上解决了jar包版本冲突的问题.
说明2: 如果需要引入其它的jar包文件,只需要添加jar包名称即可.
说明3: 特殊的jar包文件 需要手动添加版本号
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
3.3 关于build标签作用
说明: 当springboot项目需要打包时,springBoot中的build标签会起作用,将springBoot按照可以执行的方式打成jar包文件.
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.7.RELEASE</version>
<configuration>
<mainClass>com.jt.SpringbootDemo1Application</mainClass>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
如果没有build标签 则项目启动报错如下.
3.4 关于配置文件说明
3.4.1 默认配置文件名称
springboot项目 默认配置文件的名称 application.properties 名称一般固定,不会随意更改.
3.4.2 properties语法说明
语法说明:
1. 数据结构 key=value
2. value中前后不要有空格
3. properties文件 程序默认读取采用ISO-8859-1编码结构 中文必定乱码.
4. pro文件中key的名称不能复用.
3.4.3 YML语法说明
语法说明:
1. 数据结构 key:(空格)value
2. key的关键字有层级缩进效果, 注意缩进.
3. YML文件默认采用UTF-8编码格式 所以对中文友好.
4. value中不要有多余的空格
5. YML文件中key的前缀可以复用. 注意层级3.5 动态为属性赋值
3.5.1 入门案例
package com.jt.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//注解说明: @RestController = @Controller + @ResponseBody
//效果: 1. @Controller 将当前类交给Spring容器管理
// 2. @ResponseBody 前后端交互时,将后端服务器返回的对象转化为JSON
// 前后端交互媒介 http协议 传输的数据都是字符串
// JSON: 有特殊格式的字符串
@RestController
public class HelloController {
private String name = "李四";
/**
* URL: http://localhost:8080/getName
* 返回值: 变量的name属性
*/
@RequestMapping("/getName") //建议大家写绝对路径
public String getName(){
return name;
}
}
3.5.2 需求说明
由于下列的代码 将将名称直接写死到变量中,如果后续需要修改,则需要改变源码. 后期维护不便.
解决方案: 为属性动态赋值.
3.5.3 编辑YML文件
3.5.4 编辑HelloController
@RestController
public class HelloController {
//作用:从Spring容器中获取数据,需要指定key
// $ springel spel表达式
@Value("${cgbname}")
private String name; // = "王五";
/**
* URL: http://localhost:8080/getName
* 返回值: 变量的name属性
*/
@RequestMapping("/getName") //建议大家写绝对路径
public String getName(){
return name;
}
}
3.6 利用pro文件为属性赋值
3.6.1 业务说明
问题: YML文件是Spring的核心配置文件. 主要的目的是为了整合第三方框架而使用的. 如果将
大量的业务数据写到YML文件中,则会导致代码结构混乱.
解决方案: 可以使用pro文件实现业务数据处理.3.6.2 编辑pro配置文件
cgbname2=齐天大圣
3.6.3 实现数据赋值操作
package com.jt.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.PropertySource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
//注解说明: @RestController = @Controller + @ResponseBody
//效果: 1. @Controller 将当前类交给Spring容器管理
// 2. @ResponseBody 前后端交互时,将后端服务器返回的对象转化为JSON
// 前后端交互媒介 http协议 传输的数据都是字符串
// JSON: 有特殊格式的字符串
@RestController
//加载指定配置文件,并且设定字符集编码格式
@PropertySource(value = "classpath:/name.properties",encoding = "UTF-8")
public class HelloController {
//作用:从Spring容器中获取数据,需要指定key
// $ springel spel表达式
@Value("${cgbname}")
private String name; // = "王五";
@Value("${cgbname2}") //该属性是pro文件中,必须要求spring容器加载pro文件
private String name2;
/**
* URL: http://localhost:8080/getName
* 返回值: 变量的name属性
*/
@RequestMapping("/getName") //建议大家写绝对路径
public String getName(){
return name+"|"+name2;
}
}
4.1 关于maven项目加载问题
有时可能创建项目 不是maven ,需要右键点击加载.
4.2 Spring容器如何理解
4.2.1 关于IOC的说明
IOC: 控制反转
具体含义: 将对象创建的权利交给Spring容器管理.
原因: 如果将对象自己管理,则必然出现耦合性高的现象. 不方便扩展
容器: 是一种数据结构类型 Map<K,V>集合
KEY: 类名首字母小写
Value: Spring为当前的类创建的对象.
只要程序启动成功,则Map集合中(容器),里边包含了所有的IOC管理的对象
任务说明
vue脚手架安装
视频名称 VUE后台脚手架安装过程 一周后使用 上课时会给大家一个完整的项目
虚拟机安装
VMware配置说明 大约课时第15天左右开始使用
SpringBoot开箱即用原理(面试问题)
SpringBoot开箱即用原理
SpringMVC 调用流程
版权声明
本文为[[email protected]@yxg]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_49143405/article/details/121003982
边栏推荐
- NFTGameFi链游系统开发详解方案丨链游系统开发原理解析
- VCD-影音光碟
- 将字符串B插入字符串A,有多少种插入办法可以使新串是一个回文串
- Soft test preparation multimedia system
- Clion编译catkin_ws(ROS工作空间包的简称)加载CMakeLists.txt出现的问题
- A little experience of next (ITER (dataloader))
- CD-CompactDisk
- Vscode 基础必备 常用插件
- Discussion and generation of digital signature and analysis of its advantages
- Case study of row lock and isolation level
猜你喜欢
随机推荐
RSA encryption and decryption details
(必须掌握的多线程知识点)认识线程,创建线程,使用Thread的常见方法及属性,以及线程的状态和状态转移的意义
Crawl Douban to read top250 and import it into SqList database (or excel table)
Li Kou daily question - day 28 -566 Reshape matrix
Discussion and generation of digital signature and analysis of its advantages
Lm06 the mystery of constructing the bottom and top trading strategy only by trading volume
JVM入個門(1)
JS cast
VCD video disc
Summary of alter operation in SQL
transforms. The input of randomcrop() can only be PIL image, not tensor
Connected to surface test questions
你了解如何比较两个对象吗
Binary search-2
17.13 supplementary knowledge, thread pool discussion, quantity discussion and summary
Get and set settings in 26class
DVD digital universal disc
50 lines of code to crawl TOP500 books and import TXT documents
PC端录制扫515地机器人/scan数据
Vscode 基础必备 常用插件









