![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
文章平均质量分 80
码狐
Consume less, Code more
展开
-
通过配置开关 Spring Boot 中的 @Scheduled 定时任务
通过配置开关 Spring Boot 中的 @Scheduled 定时任务Spring Boot 中提供了一种非常简单的定时任务的实现方式 @Scheduled 注解,只需要加两个注解就可以轻松搞定。1. 快速上手 @Scheduled在 Spring Boot 中要想使用 @Scheduled 注解,先要在启动类上加上注解 @EnableScheduling@Configuration@EnableScheduling public class ScheduleConfig {}@Co原创 2021-02-05 00:35:45 · 2736 阅读 · 0 评论 -
「DEBUG 系列」Springboot 偶发性无法读取配置内容——Bean 加载顺序问题
线上环境测试提示读取配置时报错,但是并没有更换 jar 包也没有修改内容,只是重启了一次就莫名其妙的故障了,排查问题后发现和 Bean 加载顺序有关,特此记录问题避免再次踩坑原创 2021-01-18 11:58:37 · 257 阅读 · 0 评论 -
Spring boot @Value 注入 boolean 设置默认值问题
目录问题描述问题分析解决方案@Value 源码阅读问题描述Springboot 中读取配置文件test: 业务代码如下@Value("${test:true}")private boolean test;报错如下nested exception is org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'bo原创 2020-05-26 12:31:37 · 23033 阅读 · 3 评论