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 ...
随机推荐
- Linux命令详解-cal
cal命令可以用来显示公历(阳历)日历.公历是现在国际通用的历法,又称格列历,通称阳历."阳历"又名"太阳历",系以地球绕行太阳一周为一年,为西方各国所通用,故 ...
- numpy.random之常用函数
在实际开发中,我们经常会使用随机函数,比如交叉验证,构造测试数据等.下面,是我常用的几个生成随机样本的函数: 1,rand(n1,n2,…,nn) 每一维度都是[0.0,1.0)半闭半开区间上的随机分 ...
- day36 爬虫+http请求+高性能
爬虫 参考博客:http://www.cnblogs.com/wupeiqi/articles/5354900.html http://www.cnblogs.com/wupeiqi/articles ...
- ansible入门六(roles)
一.什么场景下会用roles? 假如我们现在有3个被管理主机,第一个要配置成httpd,第二个要配置成php服务器,第三个要配置成MySQL服务器.我们如何来定义playbook? 第一个play用到 ...
- poj 1182 食物链(高级的带权并查集)
食物链 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 76486 Accepted: 22742 Description ...
- GSpan-频繁子图挖掘算法
GSpan频繁子图挖掘算法,网上有很多相关的介绍,中文的一些资料总是似是而非,讲的不是很清楚(感觉都是互相抄来抄去,,,基本都是一个样,,,),仔细的研读了原论文后,在这里做一个总结. 1. GSpa ...
- windows 2008 server R2 服务器docker安装
1.安装包选择 windows win10 较新版本,使用 Get Docker for Windows (Stable) 或者 Get Docker for Windows (Edge) 其余使用 ...
- Spring简单与数据库连接
1.导入需要的jar包 2.配置数据源,在applicationContext.xml文件中增加配置 方式1:直接使用bean方式 1 2 3 4 5 6 <bean id="data ...
- qml 关于鼠标穿透的问题
最近在开发过程中,遇到了鼠标穿透的问题.结合网上给予的方法,都试了一圈,在这里总结一下: import QtQuick 2.9import QtQuick.Window 2.2import QtQui ...
- 添加courses模块
startapp courses from django.db import models from datetime import datetime # Create your models her ...