随笔分类 -  springboot框架项目实战

springboot框架项目实战
springboot 配置测试类
摘要:#1:添加测试类 1 <!-- springboot测试集成 --> 2 <dependency> 3 <groupId>org.springframework.boot</groupId> 4 <artifactId>spring-boot-starter-test</artifactId> 5 阅读全文

posted @ 2022-01-13 09:35 夜空中闪闪发光的星星 阅读(152) 评论(0) 推荐(0)

项目编译
摘要:1:默认情况下,maven 工具它针对我们的java目录下的非java 文件不会执行编译操作、所以在 target 目录下编译后的文件就会丢失了 xml 文件。为了防止出现编译后xml 文件丢失的情况, 步骤一:在pom.xml 当中配置一个build节点下的 <resource>结点。 1 <!- 阅读全文

posted @ 2021-12-21 23:11 夜空中闪闪发光的星星 阅读(59) 评论(0) 推荐(0)

springboot 配置文件设置
摘要:部分来源:https://www.jianshu.com/p/ebe9087b9078 前沿: springboot 默认使用 jackson 解析 json(当然这里也是可以配置使用其他 json 解析框架)。 在不配置其他 json 解析的情况下,我们可以通过 spring boot 提供的注解 阅读全文

posted @ 2021-12-21 22:48 夜空中闪闪发光的星星 阅读(90) 评论(0) 推荐(0)

springboot 项目启动立即执行的方法
摘要:#1:@PostConstruct 1 @Component 2 public class testController { 3 4 /** 5 * 项目启动时,初始化定时器 6 */ 7 @PostConstruct 8 public void init() { 9 System.out.prin 阅读全文

posted @ 2021-12-14 15:12 夜空中闪闪发光的星星 阅读(60) 评论(0) 推荐(0)

springboot Slf4j+logback日志配置以及介绍
摘要:文章引用:https://blog.csdn.net/mu_wind/article/details/99830829 #一:日志配置文件代码实现 1 <?xml version='1.0' encoding='UTF-8'?> 2 <!--日志配置--> 3 <configuration> 4 < 阅读全文

posted @ 2021-12-06 17:06 夜空中闪闪发光的星星 阅读(204) 评论(0) 推荐(0)

SpringBoot 统一异常处理
摘要:#1:主要是 `@ControllerAdvice`和ExceptionHandler两个注解,稍后会对连个注解进行解释! 1 @Slf4j 2 @ControllerAdvice 3 public class ExceptionHandle { 4 5 //记录系统异常 6 private fin 阅读全文

posted @ 2021-07-15 11:29 夜空中闪闪发光的星星 阅读(78) 评论(0) 推荐(0)

Springboot中如何实现定时任务
摘要:#一:如何基于Scheduled实现定时任务 1.1:在启动类上添加 @EnableScheduling注解 1.2:写一个方法如下: @Scheduled(cron = "0 */1 * * * ?") public void scheld() { System.out.println("手机打开 阅读全文

posted @ 2020-12-17 19:14 夜空中闪闪发光的星星 阅读(123) 评论(0) 推荐(0)