spring-boot
spring-boot
大飞NO1
这个作者很懒,什么都没留下…
展开
-
springboot集成redis缓存池pool的问题
错误提示:redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the poolCaused by: redis.clients.jedis.exceptions.JedisDataException: ERR Client sent AUTH, but no pas...原创 2019-12-23 17:51:47 · 508 阅读 · 0 评论 -
springboot整合Ueditor打包后出现erroHandler is not defined解决方法
springboot整合Ueditor打包后出现erroHandler is not defined,出现这个问题第一件事情,一定要想到config.json这个文件,99%的可能性是打包成jar后没读取出来,换个方式读取就可以了贴出我的Ueditor configManager类中的initEnv()方法,主要看这个用io流的方式读取package com.smartt.bylf.s...原创 2019-10-21 21:44:57 · 998 阅读 · 0 评论 -
springboot项目linux系统设置开机启动项(亲测可用)
springboot项目linux系统设置开机启动项先在自己电脑上新建一个txt文件,编辑成以下内容 ,编辑完后将文件编辑为 bylf-admin-start 不带后缀啊#! /bin/sh### BEGIN INIT INFO# Provides: php-fpm# Required-Start: $remote_fs $network# Re...原创 2019-10-17 11:09:34 · 2250 阅读 · 0 评论 -
springboot项目优雅的停止服务
springboot项目在启动的时候,使用java -jar styy_auth_server.jar比如我自己在公司测试服务器上写的启动文件start.sh#!/bin/shnohup java -jar styy_auth_server.jar 2>&1 > styy_auth_server.out &每次启动后,比如要更新下服务代码,就要停止服务...原创 2019-08-16 17:18:03 · 9048 阅读 · 7 评论 -
springboot事务使用
springboot事务的使用需求:一个service里面需要调用多个biz抽象类,多种insert和delete操作要求:效果是一旦其中一个biz执行失败就回滚所有先说实现方法,后上示例:spring-boot配置事务的方式,采用注解@EnableTransactionManagement注解,在启动类上添加,然后再Service的public方法上添加注解@Transactio...原创 2019-08-21 18:18:05 · 405 阅读 · 0 评论 -
swagger错误:Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body
springboot 项目,在swagger页面点击try it out 测试的时候提示“Failed to execute 'fetch' on 'Window': Request with GET/HEAD method cannot have body”根据这个提示,去找到对于的那个Controller方法,发现@GetMapping请求的方法请求参数却写了个@RequestBody。。...原创 2019-08-21 14:50:54 · 19330 阅读 · 3 评论 -
springboot项目创建全局唯一id生成器
springboot项目创建全局唯一id生成方法,参考Snowflake算法yml文件#app 全局唯一id生成app: idGenerator: workerId: 1 datacenterId: 0IdGenerator文件:package smartt.styy.auth.util;import javax.annotat...原创 2019-08-20 18:13:03 · 2695 阅读 · 0 评论 -
springboot项目异常收集发送邮箱
项目部署上线后,难免会出现异常问题,为了能及时发现问题,考虑到邮件通知方式这篇文字参考了别的大佬的博客,所有并不算是原创,如有版权问题,会及时删除文章我的项目使用的是springboot快速构建pom.xml需要的jar<!-- email --> <dependency> <groupId>org.springframew...原创 2019-08-06 15:39:20 · 412 阅读 · 0 评论 -
springboot 2.0中 PUT请求 接收不到参数解决办法
在做RestTemplate调用,springboot2.0 swagger2接口时候,参数通过HandlerInterceptorAdapter 拦截后,在controller里面获取不到 解决办法,如下swagger示例如图将请求参数封装成一个实体对象,用@RequestBody接收,就可以接收到了,之前是将多个参数 query的方式传递,接收不到值controller...原创 2019-07-25 17:47:00 · 2722 阅读 · 0 评论 -
springboot2.0 RestTemplate,get,post,put,delete设置请求header示例
package smartt.styy.auth.util;import java.net.URI;import java.nio.charset.Charset;import com.alibaba.fastjson.JSONObject;import org.springframework.core.ParameterizedTypeReference;import org.spr...原创 2019-07-25 17:31:23 · 3726 阅读 · 0 评论 -
springboot拦截器,拦截完后,传送继续传递
springboot在添加拦截器的时候,拦截完参数后,发现进入方法里面参数为空,后经百度后,发现有很多人遇到了和我一样的问题,现做写个博客,记录和分享解决方法。1.springboot添加拦截器继承HandlerInterceptorAdapter类,重写preHandle方法,这里我主要是获取requestBody里面和request里面的userId,但是在get和post请求进入方法的时...原创 2019-07-18 21:46:31 · 10569 阅读 · 0 评论 -
springboot+vue实现上传带图片的excel,并存储在相对文件夹中
项目有个需求导入excel信息,但是有个列存放的图片,比如用户头像,奇奇怪怪的需求,下面告诉大家我是怎么实现的。excel模版如下前端Vue,上传代码如下<!--上传按钮--><el-upload class="upload-demo" action='' :show-file-list="false" :before- upload="beforeUplo...原创 2019-07-05 14:29:10 · 2046 阅读 · 7 评论 -
spring boot项目添加拦截器验证token防止表单重复提交
遇到问题: 测试人员用burpsuite工具抓取表单数据,当页面点击提交数据后,工具burpsuite将截取到的数据修改后模拟发送,依然可以正常修改,解决办法 项目添加token验证, 第一步:先写token生成和销毁方法token.javapackage com.smartt.api.interceptor;import java.lang.annotation.*;原创 2017-06-29 09:49:58 · 6687 阅读 · 0 评论 -
springboot+Multipart文件上传获取失败
项目刚开始是springMVC的工程,使用ajaxfileupload.js + MultiPartFile上传图片的时候只需要在配置xml中添加即可后来项目改为springboot项目,使用ajaxfileupload.js 提交表单和图片的时候 出现表单获取不到,和图片为null解决办法,不要使用spring-boot 自带的org.springframewo原创 2017-06-19 17:15:55 · 1205 阅读 · 0 评论 -
springboot 热更新配置
spring boot使用的时候会遇到不断重启启动类的情况,热更新可以免去手动重启的烦恼在pom.xml文件中添加org.springframework.bootspring-boot-devtoolstruetrue即可原创 2017-06-28 17:16:08 · 7989 阅读 · 0 评论