springboot各种集成
fastjson
两个方法
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {
@Override
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
// 定义一个convert转换消息对象
FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter();
// 添加fastjosn配置信息, 比如是否格式化返回的json数据
// FastJsonConfig fastJsonConfig = new FastJsonConfig();
// convert中添加配置
// fastConverter.setFastJsonConfig(fastJsonConfig);
// 添加到convert中
converters.add(fastConverter);
}
}
方法2(这个可以避免null,加快速度
@Bean
public HttpMessageConverters fastJsonHttpMessageConverters() {
FastJsonHttpMessageConverter oFastConverter = new FastJsonHttpMessageConverter();
FastJsonConfig oFastJsonConfig = new FastJsonConfig();
oFastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
oFastConverter.setFastJsonConfig(oFastJsonConfig);
//处理中文乱码问题
List<MediaType> oFastMediaTypeList = new ArrayList<>();
oFastMediaTypeList.add(MediaType.APPLICATION_JSON_UTF8);
oFastConverter.setSupportedMediaTypes(oFastMediaTypeList); HttpMessageConverter<?> oConverter = oFastConverter;
return new HttpMessageConverters(oConverter);
}
pagehelper
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.4</version>
</dependency>
druid
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.1.9</version>
</dependency>
mybatis(在实体类改了DO后缀的,记得在xml改
mybatis:
typeAliasesPackage: com.biao.entity
mapper-locations: classpath:mapper/*/*.xml
configuration:
#配置项:开启下划线到驼峰的自动转换. 作用:将数据库字段根据驼峰规则自动注入到对象属性。
map-underscore-to-camel-case: true #打印SQL信息
logging:
level:
com:
biao:
dao: DEBUG
@MapperScan("com.biao.dao")
ps:由于在mybaits使用了@Mapper的注解代替原来的@repository,因此idea会监测到错误,因为idea只能检查java标准的注解和spring的,除非加了mybatis的插件(要收费),所以把Autowired的错误改了警告编译就能通过了

springboot各种集成的更多相关文章
- springboot elasticsearch 集成注意事项
文章来源: http://www.cnblogs.com/guozp/p/8686904.html 一 elasticsearch基础 这里假设各位已经简单了解过elasticsearch,并不对es ...
- Springboot Application 集成 OSGI 框架开发
内容来源:https://www.ibm.com/developerworks/cn/java/j-springboot-application-integrated-osgi-framework-d ...
- SpringBoot项目集成Hystrix
Hystrix Hystrix是由Netflix开源的一个服务隔离组件,通过服务隔离来避免由于依赖延迟.异常,引起资源耗尽导致系统不可用的解决方案. 1.什么是服务熔断 服务熔断就是对该服务的调用 ...
- 钉钉通知机器人与SpringBoot的集成
Spring Boot Admin 集成自定义监控告警(2.0.1版本)------钉钉机器人 - yuancao24的博客 - CSDN博客https://blog.csdn.net/yuancao ...
- SpringBoot项目集成PageHelper使用
SpringBoot项目集成PageHelper使用 一.开始 地址:https://github.com/pagehelper/Mybatis-PageHelper 在spring boot ...
- Springboot简单集成ActiveMQ
Springboot简单集成ActiveMQ 消息发送者的实现 pom.xml添加依赖 <dependency> <groupId>org.springframework.bo ...
- 在springboot中集成mybatis开发
在springboot中利用mybatis框架进行开发需要集成mybatis才能进行开发,那么如何在springboot中集成mybatis呢?按照以下几个步骤就可以实现springboot集成myb ...
- 在springboot中集成jsp开发
springboot就是一个升级版的spring.它可以极大的简化xml配置文件,可以采用全注解形式开发,一个字就是很牛.在springboot想要使用jsp开发,需要集成jsp,在springboo ...
- Swagger详解(SpringBoot+Swagger集成)(转)
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明.本文链接:https://blog.csdn.net/ai_miracle/article/de ...
- springboot中集成memcached
前言 Memcached 是一个高性能的分布式内存对象缓存系统,其存储性能在某些方面不比redis差,甚至在文本类型数据的存储上性能略优于redis,本文将介绍如何在springboot中集成memc ...
随机推荐
- ML之多元线性回归
转自:http://www.cnblogs.com/zgw21cn/archive/2009/01/07/1361287.html 1.多元线性回归模型 假定被解释变量与多个解释变量之间具有线性关系, ...
- Python批量修改图片格式和尺寸
Python批量修改图片格式和尺寸 备注: 1.导入了PIL库,是处理图片用的,很强大; 2.导入了的win32库,是判断隐藏文件用的,我们的项目需要删除隐藏文件,不需要的可以直接找到删除. 3.导入 ...
- Partition 1 does not start on physical sector boundary.分区信息不正常
[root@v1 ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 20G 3.3G 16G ...
- DNS智能解析的搭建与配置
分类: LINUX 原文地址:DNS智能解析的搭建与配置 作者:十年梦生 9月份整整忙了一个月,都抽不出时间来写篇文章,这几天趁着10.1终于有时间来写些东西了,将9月份所做的一些东西来做下总结. ...
- Ti IPNC Web网页之ActiveX控件
Ti IPNC Web网页之ActiveX控件 本篇介绍关于TI IPNC网页中播放器相关的东西. gStudio工程中添加播放器并控制播放器 打开IPNC网页时首先会自动下载ActiveX控件并安装 ...
- 12.18 微信扫码获取openid与登陆
官方文档: https://open.weixin.qq.com/ 1.先获取code 1-1 配置项目配置文件 wechat: mpAppId: wxd898fcb01713c658 mpAppSe ...
- shell脚本实例二
练习题一:对已经存在的用户做密码的修改等操作 vim user_ctrl.sh ##进行如下编写 #!/bin/bashShow(){ read -p ...
- Buildroot构建指南--Overview
使用Buildroot,让嵌入式Linux系统构建更加便捷.本文以Buildroot-2016.05的版本为基础来讲解,不同版本之间有细节差异,需要根据读者使用的版本自行调整. Buildroot是什 ...
- java.sql.SQLException: Unsupported character encoding 'utf8mb4'.
四月 12, 2017 3:47:52 下午 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() fo ...
- 将EasyRTMP_RTSP移植到Android平台实现的RTSP拉流转推RTMP直播流功能
本文转自EasyDarwin开源团队成员Kim的博客:http://blog.csdn.net/jinlong0603/article/details/73253044 前言 安防互联网化的需求已经越 ...