![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
后端开发
柯小帅
华为开发
展开
-
EasyExcel实现excel的读写操作
1.导入EasyExcel依赖 <dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>2.1.1</version> </dependency>2.建立表头对应的实体类package com.atgugui.excel;imp原创 2022-05-10 11:35:36 · 510 阅读 · 1 评论 -
错误:Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedded
问题:Failed to configure a DataSource: ‘url’ attribute is not specified and no embedded datasource could be configured.出现问题原因:导入了数据的依赖,但是并没有配置数据库源解决:注解中排出数据库源原创 2022-05-09 10:49:36 · 389 阅读 · 0 评论 -
MyBatisPlus使用like进行模糊查询不生效
问题:MyBatisPlus使用like进行模糊查询不生效解决:配置文件的数据库地址后面加上&characterEncoding=utf8原创 2022-05-06 14:08:34 · 1823 阅读 · 0 评论 -
springboot实现统一日志管理
1.设置全局日志级别日志级别有以下几种:OFF、FATAL、ERROR、WARM、INFO、DEBUG、ALL#设置日志级别logging.level.root=INFO2、把日志输出到文件中,使用日志工具logback和log4j均可一、先删除application.properties的日志配置二、在resources里创建文件logback-spring.xml<?xml version="1.0" encoding="UTF-8"?><configuratio原创 2022-05-03 10:02:41 · 855 阅读 · 0 评论 -
springboot实现统一异常处理
package com.atguigu.servicebase.exceptionhandler;import com.atguigu.commonutils.R;import org.springframework.web.bind.annotation.ControllerAdvice;import org.springframework.web.bind.annotation.ExceptionHandler;import org.springframework.web.bind.annot原创 2022-05-02 22:00:10 · 436 阅读 · 0 评论 -
springboot注解实现自动插入创建时间和更新时间到数据库
1.在实体类上加注解@TableField(fill = FieldFill.INSERT)2.增加配置类package com.atguigu.servicebase.handler;import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;import org.apache.ibatis.reflection.MetaObject;import org.springframework.stereotype.Compone原创 2022-05-02 14:19:25 · 4028 阅读 · 0 评论 -
springboot项目实现统一返回类型R
1.实现一个code代码的接口package com.atguigu.commonutils;public interface ResultCode { public static final Integer SUCCESS = 20000; public static final Integer ERROR = 20001;}2.实现统一返回方法R类package com.atguigu.commonutils;import io.swagger.annotatio原创 2022-05-01 17:16:36 · 1170 阅读 · 0 评论 -
swagger2配置安装教程
1.引入swagger2依赖<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version></dependency><dependency> <groupId>io.springfox</groupId>原创 2022-05-01 16:31:56 · 327 阅读 · 0 评论 -
springboot注解方式实现逻辑删除
问题:springboot注解方式实现逻辑删除1.增加配置插件2.增加实体类相关字段注解原创 2022-05-01 13:39:30 · 854 阅读 · 0 评论 -
springboot 实现文件上传至当前项目下文件夹
需求:上传文件至当前项目下的一个文件夹里面Service文件:package com.kech.reggie.service;import org.springframework.stereotype.Service;import org.springframework.web.multipart.MultipartFile;import java.io.File;import java.io.IOException;import java.nio.file.Path;import j原创 2022-04-19 10:53:10 · 1446 阅读 · 0 评论 -
登录拦截使用Filter过滤器实现
一、过滤器的作用和概述1.1 简述人—>检票员(filter)—> 电影院。注意:配置多个filter的时候,要设置编号id,值越小,优先级越高,越先执行。在3.0之后新增@WebFilter注解,当使用注解配置多个Filter时,用户无法控制其执行顺序,此时Filter过滤的顺序是按照Filter的类名来控制的,按自然排序的规则。1.2 使用场景场景:权限控制、用户登录(非前端后端分离场景)等,过滤非法登录1.3 依赖支持 <!--spring boot的启动类 --&g原创 2022-04-17 12:34:25 · 1613 阅读 · 0 评论 -
Springboot实现上传文件以及文件实时预览(包括图片预览,视频预览)
1.实现文件存储功能(直接写成业务方法,方便后续使用)package com.smartbird.clouddisk.service;import com.smartbird.clouddisk.common.exception.BusException;import com.smartbird.clouddisk.config.StorageProperties;import org.springframework.beans.factory.annotation.Autowired;impo原创 2022-03-18 10:53:47 · 10096 阅读 · 4 评论