摘要:#1:添加测试类 1 <!-- springboot测试集成 --> 2 <dependency> 3 <groupId>org.springframework.boot</groupId> 4 <artifactId>spring-boot-starter-test</artifactId> 5
阅读全文
摘要:1:默认情况下,maven 工具它针对我们的java目录下的非java 文件不会执行编译操作、所以在 target 目录下编译后的文件就会丢失了 xml 文件。为了防止出现编译后xml 文件丢失的情况, 步骤一:在pom.xml 当中配置一个build节点下的 <resource>结点。 1 <!-
阅读全文
摘要:部分来源:https://www.jianshu.com/p/ebe9087b9078 前沿: springboot 默认使用 jackson 解析 json(当然这里也是可以配置使用其他 json 解析框架)。 在不配置其他 json 解析的情况下,我们可以通过 spring boot 提供的注解
阅读全文
摘要:#1:@PostConstruct 1 @Component 2 public class testController { 3 4 /** 5 * 项目启动时,初始化定时器 6 */ 7 @PostConstruct 8 public void init() { 9 System.out.prin
阅读全文
摘要:文章引用:https://blog.csdn.net/mu_wind/article/details/99830829 #一:日志配置文件代码实现 1 <?xml version='1.0' encoding='UTF-8'?> 2 <!--日志配置--> 3 <configuration> 4 <
阅读全文
摘要:#1:主要是 `@ControllerAdvice`和ExceptionHandler两个注解,稍后会对连个注解进行解释! 1 @Slf4j 2 @ControllerAdvice 3 public class ExceptionHandle { 4 5 //记录系统异常 6 private fin
阅读全文
摘要:#一:如何基于Scheduled实现定时任务 1.1:在启动类上添加 @EnableScheduling注解 1.2:写一个方法如下: @Scheduled(cron = "0 */1 * * * ?") public void scheld() { System.out.println("手机打开
阅读全文