Spring boot 入门学习
1、Spring boot官网
https://spring.io/projects/spring-boot
2、Spring boot介绍
帮助我们快捷、简单的创建一个产品级应用,简化开发。 
3、单体应用介绍
所有功能打包在一起 缺点:
● 代码臃肿,应用启动时间长; ● 回归测试周期长,修复一个小小bug可能都需要对所有关键业务进行回归测试; ● 应用容错性差,某个小小功能的程序错误可能导致整个系统宕机; ● 伸缩困难,单体应用扩展性能时只能整个应用进行扩展,造成计算资源浪费; ● 开发协作困难,一个大型应用系统,可能几十个甚至上百个开发人员,大家都在维护一套代码的话,代码merge复杂度急剧增加; 作者:centychen 链接:https://www.jianshu.com/p/7293b148028f 来源:简书
4、微服务介绍
一组小型服务,通过HTTP的方式进行互通。它使整个系统分工明确、每个人只需负责自己的模块,每一个功能元素最终都是一个可独立替换和独立升级的软件单元。
5、开发环境
- JDK 1.8
- IntelliJ IDEA 2019.3 x64
- apache-maven-3.6.3
- Spring boot 1.5.9 RELEASE
6、开发配置
- Maven下的settings中,设置JDK为1.8
- IDEA中设置Maven为apache-maven-3.6.3

7、简单开发
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
package com.dwt;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class HelloWordApplication {
public static void main(String[] args) {
SpringApplication.run(HelloWordApplication.class,args);
}
}
package com.dwt.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@Controller
public class HelloController {
@ResponseBody
@RequestMapping("/hello")
public String Hello(){
return "Hello,World!";
}
}
- 启动Main方法测试

|