从零开始学SpringBoot笔记001(认识)
来源:互联网 发布:la域名收录怎么样 编辑:程序博客网 时间:2024/05/26 19:19
源码地址:http://download.csdn.net/download/u010503822/10020714
注明:该内容来自Andy讲师视频整理
SpringBoot
目的:
简化Spring配置
特性:
1.创建独立的spring应用程序
2.嵌入tomcat,无需war文件
3.简化maven
4.自动配置spring
5.提供生产就绪型功能,如指标,健康检查
6.开箱即用,没有代码生成,也无需xml配置
简单理解:
1.入门体验更好
2.开箱即用,没有代码生成
3.提供了非功能特性,如:指标,健康检测
4.更快速的使用spring的方式
使用的注解
@RectController 等价于 @Controller @ResponseBody
@SpringApplication指定一个spring boot应用启动程序
SpringBoot默认解析的数据交互默认就是json
fastjon支持两种方法(json序列化日期格式)
1.启动类继承extends WebMvcConfigurerAdapter
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) { super.configureMessageConverters(converters); //1.需要先定义一个convert 转换消息的对象 FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); //2.添加fastjson的配置信息,比如:是否要格式化返回的json数据 FastJsonConfig fastJsonConfig = new FastJsonConfig(); //3.在convert中添加配置信息 fastJsonConfig.setSerializerFeatures( SerializerFeature.PrettyFormat ); fastConverter.setFastJsonConfig(fastJsonConfig); //4.将convert添加到converters converters.add(fastConverter); }
2.覆盖方法configureMessageConverters
@Bean public HttpMessageConverters fastJsonHttpMessageConverters() { //1.需要先定义一个convert 转换消息的对象 FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); //2.添加fastjson的配置信息,比如:是否要格式化返回的json数据 FastJsonConfig fastJsonConfig = new FastJsonConfig(); //3.在convert中添加配置信息 fastJsonConfig.setSerializerFeatures( SerializerFeature.PrettyFormat ); fastConverter.setFastJsonConfig(fastJsonConfig); HttpMessageConverter<?> converter = fastConverter; return new HttpMessageConverters(converter); }
阅读全文
0 0
- 从零开始学SpringBoot笔记001(认识)
- 从零开始学SpringBoot笔记002(热部署)
- 从零开始学 SpringBoot (1)
- 从零开始学android:认识Android
- 从零开始学java第一章 认识java
- 从零开始学java(一)认识java
- 40. springboot + devtools(热部署)【从零开始学Spring Boot】
- 40. springboot + devtools(热部署)【从零开始学Spring Boot】
- 从零开始学SpringBoot(2)全局异常捕捉
- 从零开始springBoot
- 从零开始学
- 28. SpringBoot启动时的Banner设置【从零开始学Spring Boot】
- 28. SpringBoot启动时的Banner设置【从零开始学Spring Boot】
- (28)SpringBoot启动时的Banner设置【从零开始学Spring Boot】
- 重学QT,以前只学习框架,而没有认识其内部,从零开始
- 学习笔记 从零开始学单片机(0) 系统结构
- 学习笔记 从零开始学单片机(1) 建立实验环境
- 学习笔记 从零开始学单片机(2) 全八段数码管显示
- 自定义标签的开发与应用
- 51nod-1574-排列转换
- 工作一周年
- 安装cuda8.0老报错kernel source路径问题,最后这种办法解决了
- IntentService源码分析
- 从零开始学SpringBoot笔记001(认识)
- CentOS7 开启网卡自动获取IP
- 公开课可下载资源汇总
- javafx加载不同包中的fxml文件
- 选项卡的制作和数组
- 国庆清北刷题冲刺班 Day2 下午
- K叉树的运算
- hdu5952 Counting Cliques(爆搜)
- redis在spring中的使用