基于Gradle构建的SpringBoot源码中创建测试包时,没有启动类解决办法
打开创建的build.gradle文件
在dependencies标签中添加如下代码:
annotationProcessor(project(":spring-boot-project:spring-boot-tools:spring-boot-configuration-processor"))
implementation(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
implementation(enforcedPlatform(project(":spring-boot-project:spring-boot-dependencies")))
implementation(project(":spring-boot-project:spring-boot"))
点击右上角刷新按钮
等待片刻…
然后在 main 包下创建启动类:
com.***.SpringBootDebugApplication
@SpringBootApplication
public class SpringBootDebugApplication {
public static void main(String[] args) {
SpringApplication.run(SpringBootDebugApplication.class, args);
}
}
此时就可以debug运行开始阅读源码了