本篇主要演示 springboot 中自定义 starter 的实例,不涉及底层原理。
首先,创建一个什么都没有的工程作为父工程,这个工程不需要进行任何操作,然后创建两个模块,分别命名为 tyu-hello-spring-boot-starter
,tyu-hello-spring-boot-starter-autoconfigure
一个是启动器,一个是自动配置包。【只需创建简单的 maven 工程即可,也可以通过idea中spring模板创建】
如下:
在 tyu-hello-spring-boot-starter-autoconfigure
导入以下依赖:
<?xml version="1.0" encoding="UTF-8"?>
<project</