微服务Spring Boot完整知识体系教程

一、微服务Spring Boot

(一)基础知识

1、优点:

  1. 简化 Spring 应用搭建和开发过程
  2. 去除大量 XML 配置文件
  3. 简化复杂依赖管理

2、技术基础:

Java 基础、Servlet、JDBC、Maven、Spring、Spring MVC、MyBatis 

3、特点:

1. 独立运行的 Spring 项目
以 jar 包形式独立运行
项目只需通过命令“ java–jar xx.jar” 即可运行
2. 内嵌 Servlet 容器
使用嵌入式 Servlet 容器(Tomcat、Jetty 、 Undertow)
应用无需打成 WAR 包 
3. 提供 starter 简化 Maven 配置
提供一系列“starter”项目对象模型(POMS)来简化 Maven 配置
4. 提供大量自动配置
提供大量默认自动配置、简化项目开发
开发人员也通过配置文件修改默认配置
5. 自带应用监控
可对正在运行项目提供监控
6. 无代码生成和 xml 配置
不需要任何 xml 配置即可实现 Spring 的所有配置

(二)环境搭建

1、开发平台:IntelliJ IDEA

2、版本选择:稳定

	Spring Boot		2.x
	JDK				8.0 及以上版本
	Maven			3.x
	IntelliJ IDEA	14.0 以上

3、创建 Spring Boot 项目

1. 使用 Maven 创建:自行查找教程(略)
  1. 依赖文件:pom.xml
  <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.4.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
  1. 主程序:helloWorldApplication.java——@SpringBootApplication
package net.biancheng.www;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class helloWorldApplication {
    public static void main(String[] args) {
        SpringApplication.run(helloWorldApplication.class, args);
    }
}
2. 使用 Spring Initializr 创建
Spring 项目创建向导(Spring Initializr )
1 方式1: Projects → New Project
2 方式2:File → New → Project → Spring Initializr
问题:https://start.spring.io——去掉https的s
  1. Web → Spring Web Starter
  2. Template → Thymeleaf
  3. SQL → Spring Data JPA → Mysql Driver

二、第三方库配置:零配置、自动配置、

开箱即用(out-of-the-box)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值