文章分类 -  SpringBoot

摘要:自定义全局异常和返回封装 自定义返回实体 package com.lwp.util; import lombok.Data; /** * @author: liuwenpu * @date: 2021/10/2514:55 * @description: 统一返回类 */ @Data public 阅读全文
posted @ 2021-10-25 23:14 幸运刘 阅读(103) 评论(0) 推荐(0)
摘要:springboot使用AOP 依赖引入 <!--添加aop依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-aop</artifactId> </depend 阅读全文
posted @ 2021-07-24 17:19 幸运刘 阅读(47) 评论(0) 推荐(0)
摘要:异步任务、定时任务、邮件发送 异步任务 启动类添加@EnableAsync注解,代表启用异步 service处理类方法添加@Async,标识该方法为异步处理 定时任务 启动任务调度 启动类添加@EnableScheduling注解,表示开启任务调度 编写任务调度类运行 @Component publ 阅读全文
posted @ 2021-07-09 22:42 幸运刘 阅读(49) 评论(0) 推荐(0)
摘要:Swagger集成 Swagger官网 https://swagger.io/docs 依赖导入 <!-- Swagger2依赖 --> <dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</ar 阅读全文
posted @ 2021-07-09 00:48 幸运刘 阅读(91) 评论(0) 推荐(0)
摘要:mybatis集成 导入starter依赖 <!--mybatis依赖--> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <v 阅读全文
posted @ 2021-07-07 23:02 幸运刘 阅读(57) 评论(0) 推荐(0)
摘要:alibabaDruid集成 依赖导入 <!--alibaba数据连接池--> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10 阅读全文
posted @ 2021-07-06 00:18 幸运刘 阅读(192) 评论(0) 推荐(0)
摘要:JDBC集成 配置依赖 <!--jdbc依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <!- 阅读全文
posted @ 2021-07-05 23:06 幸运刘 阅读(38) 评论(0) 推荐(0)
摘要:自定义配置扩展 mvc配置扩展 自定义视图解析器 自定义类实现WebMvcConfigurer接口 @Configuration //标识配置类 public class MyMvcConfig implements WebMvcConfigurer { //注册自定义视图解析器 @Bean pub 阅读全文
posted @ 2021-07-05 22:01 幸运刘 阅读(38) 评论(0) 推荐(0)
摘要:常用注解 //读取yaml中的配置注入到实体类 @ConfigurationProperties(prefix="student") public class Student { ...属性需要和yaml中名称对应,支持松散语法,yaml中使用mz-name对应java中的驼峰mzName } // 阅读全文
posted @ 2021-07-03 23:35 幸运刘 阅读(26) 评论(0) 推荐(0)
摘要:yaml学习 基础语法 #普通的key-value写法 name: liuwenpu #对象写法 Student: name: liuwenpu age: 18 #行内对象写法 Student1: {name: liuwenpu,age: 18} #数组 pets: - cat - dog - pi 阅读全文
posted @ 2021-07-03 21:19 幸运刘 阅读(33) 评论(0) 推荐(0)
摘要:SpringBoot自动装配原理 自动配置 pom.xml spring-boot-dependencies:核心依赖在父工程中 我们在写或者引入一下SpringBoot依赖的时候,不需要指定版本的依赖,就因为有这些版本仓库 启动器 启动器:就是Springboot的启动场景 比如spring-bo 阅读全文
posted @ 2021-07-03 21:07 幸运刘 阅读(46) 评论(0) 推荐(0)