
如何在Springboot 项目启动后执行某些自定义代码逻辑
������������
��������������������������������������������� ��������������� ��������������� ������������
��������������������������������������������� ��������������� ���������������
发布日期:2021-05-15 01:32:41
浏览次数:16
分类:精选文章
本文共 1968 字,大约阅读时间需要 6 分钟。
������������������������������������
���������������������������������������������������Spring Boot ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������
Spring Boot ������������������������������������������������������������������CommandLineRunner
��� ApplicationRunner
������������������������������������������������������������������������������������������������
������������CommandLineRunner
CommandLineRunner
���������- ���������������������������������������������������������������������
@Order
������������������������������@Order(1)
������������������������������������������������������
@Component@Order(1)public class MyStartRunner implements CommandLineRunner { @Override public void run(String... args) throws Exception { System.out.println("������������������������������������issors���Grace Hopper"); }}
������������ApplicationRunner
ApplicationRunner
���������- ���������������������������������������������������
ApplicationRunner
������������
@Componentpublic class MyApplicationRunner implements ApplicationRunner { @Override public void run(ApplicationArguments args) throws Exception { System.out.println("������������������ApplicationRunner������������"); // ������������ args.getOptionValues("your-option") ��������������������� }}
������������
- ������������������������������������������������������������
--enable debug
������������������ApplicationRunner
��� - ������������������������������������������������������������������������������������������
CommandLineRunner
���������������
���������������������������������������Spring Boot������������������������������������������������������������������������������
发表评论
最新留言
初次前来,多多关照!
[***.217.46.12]2025年04月24日 10时57分31秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
制作JS验证码(简易)
2021-05-14
adb通过USB或wifi连接手机
2021-05-14
泛型机制 Generic
2021-05-14
包装类
2021-05-14
JDK9-15新特性
2021-05-14
集合继承结构
2021-05-14
LinkedList 实现类
2021-05-14
Vector 实现类
2021-05-14
HashMap类、HashSet
2021-05-14
HashTable类
2021-05-14
TreeSet、TreeMap
2021-05-14
ObjectInputStream、ObjectOutputStream
2021-05-14
JVM内存模型
2021-05-14
反射机制
2021-05-14
反射Field、Method、Constructor
2021-05-14
可变长度参数
2021-05-14
堆空间常用参数总结
2021-05-14
3、条件查询
2021-05-14
5、分组函数 / 聚合函数
2021-05-14