SpringBoot个人学习简录

1、SpringBoot2.x依赖环境和版本新特性说明

1、依赖版本jdk8以上, Springboot2.x用JDK8, 因为底层是 Spring framework5,
2、安装maven最新版本,maven3.2以上版本,下载地址 :https://maven.apache.org/download.cgi
3、Eclipse或者IDE
4、新特性
5、翻译工具:https://translate.google.cn/
6、springbootGitHub地址:https://github.com/spring-projects/spring-boot
7、springboot官方文档:https://spring.io/guides/gs/spring-boot/

2、快速创建SpringBoot2.x应用

1、手工创建:http://spring.io/guides/gs/rest-service/(备注:网址已更新,与视频录制时不一样,笔记里为更新的网址)
官方推荐包命名接口,不要使用默认 defaultPackage
官方文档: https://docs.spring.io/spring-boot/docs/2.1.0.BUILD-SNAPSHOT/reference/htmlsingle/#using-boot-using-the-default-package

2、工具自动创建:http://start.spring.io/

3、SpringBoot2.xHTTP请求配置讲解

简介:SpringBoot2.xHTTP请求注解讲解和简化注解配置技巧

1、@RestController 和@RequestMapping  是springMVC的注解,不是springboot特有的	
2、@RestController = @Controller+@ResponseBody	,如果前后端分离且需要从后端传Json格式的数据就需要用@RestController ,否则报错
3、在SpringBoot默认启动类中使用可只引用@SpringBootApplication,也可引用如下三个,效果一致(如下图):
@SpringBootApplication = @Configuration+@EnableAutoConfiguration+@ComponentScan

在这里插入图片描述

4、SpringBoot基础HTTP接口GET请求实

简介:讲解springboot接口,http的get请求,各个注解使用

	1、GET请求
		1、单一参数@RequestMapping(path = "/{id}", method = RequestMethod.GET)
			1) public String getUser(@PathVariable String id ) {}
			
			2)@RequestMapping(path = "/{depid}/{userid}", method = RequestMethod.GET) 可以同时指定多个提交方法
			getUser(@PathVariable("depid") String departmentID,@PathVariable("userid") String userid)

			3)一个顶俩
			@GetMapping = @RequestMapping(method = RequestMethod.GET)
			@PostMapping = @RequestMapping(method = RequestMethod.POST)
			@PutMapping = @RequestMapping(method = RequestMethod.PUT)
			@DeleteMapping = @RequestMapping(method = RequestMethod.DELETE)

			4)@RequestParam(value = "name", required = true)
				可以设置默认值,比如分页 

			4)@RequestBody 请求体映射实体类
				需要指定http头为 content-type为application/json charset=utf-8

			5)@RequestHeader 请求头,比如鉴权
				@RequestHeader("access_token") String accessToken

			6)HttpServletRequest request自动注入获取参数

5、yml和propertise的区别

(1)、默认情况下是properties结尾的配置文件,都放在src/main/resources目录。
(2)、书写规范不一样

application.properties文件配置:

//随机端口号server.port=${random.int[1024,9999]}

server.port=9090

gx.msg=hi,hello world

转换为application.yml文件配置:

server:

  port: 9090

gx:

  msg: hi,hello world
  以空格的缩进程度来控制层级关系,空格个数不重要。

(3)、加载顺序不同
正常的情况是先加载yml,接下来加载properties文件。如果相同的配置存在于两个文件中。最后会使用properties中的配置。最后读取的优先集最高。

6、SpringBoot思维导图

1.Spring boot 简介

在这里插入图片描述

2.Spring boot 的特性

在这里插入图片描述

3.Spring boot 开发环境

在这里插入图片描述

4.第一个 Spring boot 程序

在这里插入图片描述

5.第一个 Spring boot 程序解析

在这里插入图片描述

6.Spring boot 的核心配置文件

在这里插入图片描述

7.Spring boot 自定义配置

在这里插入图片描述

8.Spring boot 下的 Spring mvc

在这里插入图片描述

9.Spring boot 使用 JSP

在这里插入图片描述

10.Spring boot 集成 MyBatis

在这里插入图片描述

11.Spring boot 事务支持

在这里插入图片描述

12.Spring boot 实现 RESTfull API

在这里插入图片描述

13.Spring boot 热部署插件

在这里插入图片描述

14.Spring boot 集成 Redis

在这里插入图片描述

15.Spring boot 集成 Dubbo

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

16.Spring boot 使用拦截器

在这里插入图片描述

17.Spring boot 中使用 Servlet

在这里插入图片描述
在这里插入图片描述

18.Spring boot 中使用 Filter

在这里插入图片描述
在这里插入图片描述

19.Spring boot 项目配置字符编码

在这里插入图片描述

20.Spring Boot 非web应用程序

在这里插入图片描述

21.Spring boot 程序war包部署

在这里插入图片描述

22.Spring boot 程序打Jar包与运行

在这里插入图片描述

23.Spring boot 部署与运行方式总结

在这里插入图片描述

24.spring boot 集成 Spring session

在这里插入图片描述

26.Spring boot Actuator

在这里插入图片描述
在这里插入图片描述

27.Spring boot 综合案例

在这里插入图片描述

总结

(1)采用Spring Boot开发实质上也是一个常规的Spring项目开发;
(2)只是利用了Spring Boot启动程序和自动配置简化开发过程,提高开发效率;
(3)Spring boot项目开发代码的实现依然是使用Spring mvc + spring + mybatis 等,当然能集成几乎所有的开源项目;
(4)采用Spring boot开发,需要掌握大量的注解,所以日常开发中注意对注解的积累;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值