
Spring Boot
Spring Boot 一些经验的分享
猴子请来的坑逼
追逐梦想,保持热爱
展开
-
使用pagehelper 实现 mybatis 分页查询
PageHelper是一款优秀的MyBatis分页插件。通过物理分页方式直接在数据库层面进行分页,优化了大数据量的处理。使用时只需在查询前调用startPage方法即可实现分页。支持多种流行数据库,且能提供丰富的分页信息如总记录数、总页数等。同时,其配置灵活,与MyBatis、Spring Boot等框架兼容性良好,大大简化了分页操作。通过PageHelper即可实现在mybatis中分页查询操作原创 2023-06-06 17:55:21 · 1165 阅读 · 0 评论 -
springboot自带MD5加密
springboot自带MD5加密import org.springframework.util.DigestUtils;/** * @ProjectName: PlatfromServiceCenter * @Package: com.ge.start * @ClassName: Test * @Author: bianhailong * @Description: * @Date: 6/17/2021 2:32 PM */public class Test { publi原创 2021-06-17 14:35:51 · 595 阅读 · 0 评论 -
发送HTTP请求中文参数乱码的问题,空格变加号(+)的问题
在请求头参数或者返回参数存在中文时,出现乱码的问题。可以使用URLEncoder.encode()方法来解决,但是URLEncoder.encode()方法会将空格转换成+,解码后会发现+没有转换回来,这要特殊处理一下,将空格直接转换成%20private String formate(String str) throws UnsupportedEncodingException { String sign = "QAQ我是一只小芋头";//自己定义,确保参数中不会存在该字符串就可以,越原创 2021-06-01 09:58:01 · 1895 阅读 · 0 评论 -
Spring Boot new出来的对象中 使用@autowired进行对象bean注入 值为null
在程序运行时,新new出来的类 使用了@autowired注入, 发现没有注入成功,对象的值是null例如下面有个websocket服务,当前端有新的连接是,会new一个通道,也就是new一个MyServer对象,当我使用ActuatorOperation操作类时,actuatorOperation对象的值为nullActuatorOperation 类import com.ge.code.actuator.domain.Actuator;import com.ge.code.actuator.do原创 2021-04-26 16:17:42 · 2960 阅读 · 0 评论 -
Spring Boot Actuator 参数说明
基本监控指标Endpoint IDDescriptionauditevents显示应用暴露的审计事件 (比如认证进入、订单失败)info显示应用的基本信息health显示应用的健康状态metrics显示应用多样的度量信息loggers显示和修改配置的loggerslogfile返回log file中的内容(如果logging.file或者logging.path被设置)httptrace显示HTTP足迹,最近100个HTTP reques原创 2021-04-26 13:48:44 · 1649 阅读 · 0 评论 -
spring boot 集成 websocket服务
pom.xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-websocket</artifactId></dependency>WebSocketConfig通过这个配置 spring boot 才能去扫描后面的关于 websocket 的注解import org.springfram原创 2021-04-26 13:23:44 · 281 阅读 · 0 评论 -
Spring Boot Actuator没有httptrace 端点的问题
在使用Spring Boot Actuator时,发现其它端点都是可以访问的,唯独httptrace 不可以访问。初步判断是Spring Boot的版本问题,在版本为“2.0.6.RELEASE”时是可以正常访问的,在“2.4.3版本中无法访问”解决办法:在不更改版本的情况下,需要自定义HttpTraceRepositoryConfiguration类@Configuration@ConditionalOnWebApplication@ConditionalOnProperty(prefix原创 2021-04-20 18:05:16 · 1052 阅读 · 3 评论