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 ...
随机推荐
- 获取CPU和内存的使用率
1.获取CPU的使用率 主要就是一个计算. int CUseRate::GetCPUUseRate() //获取CPU使用率 { ; FILETIME ftIdle, ftKernel, ftUser ...
- buffer与cache的区别
top命令中有两项与内存相关的东西:buffer和cache.这两项与页高速缓存相关.磁盘的操作有逻辑级(文件系统)和物理级(磁盘块),这两种Cache就是分别缓存逻辑和物理级数据的. 在linux内 ...
- HDU 4283 You Are the One ★(进出栈的括号匹配性质:区间DP)
题意 有一个队列,每个人有一个愤怒值D,如果他是第K个上场,不开心指数就为(K-1)*D.但是边上有一个小黑屋(一个FILO堆栈),可以一定程度上调整上场程序,求一种安排上场方案使得所有人的不开心指数 ...
- shell---正则表达式和文本处理器
-----正则表达式----- grep -n :显示行号 -o :只显示匹配的内容 -q :静默模式,没有任何输出,得用$?来判断执行成功没有,即有没有过滤到想要的内容 -l :如果匹配成功 ...
- (转)让IE6/IE7/IE8浏览器支持CSS3属性
原文链接 http://blog.csdn.net/h5_queenstyle12/article/details/50437442 一.下载 搜索下载:ie-css3.htc,它是让IE浏览器支持C ...
- VS2010制作安装程序
转自(http://blog.csdn.net/wenmang1977/article/details/7733685) 序 前些天想写一下制作安装程序,由于要写的内容比较多,一拖再拖,不过坚持就是胜 ...
- hdu1151
题解: 二分图边覆盖 n-最大匹配 代码: #include<cstdio> #include<cmath> #include<algorithm> #includ ...
- Django-自定义分页组件
1.封装的分页代码: class PageInfo(object): def __init__(self,current_page,all_count,per_page,base_url,show_p ...
- String类的编码和解码问题
我们前面知道同一个字符在利用不同的编码表得到的结果一般是不一样的. 这里讨论个字符串的编码和解码问题 字符串的一些方法: String(byte[] b,Charset charset); Strin ...
- 链表实现队列C语言写法
#include<iostream> #include<cstdio> #include<cstdlib> using namespace std; typedef ...