1. 打开项目.idea文件夹里面的workspace.xml文件,在最后加上以下代码
xml
<component name="RunDashboard">
<option name="configurationTypes">
<set>
<option value="SpringBootApplicationConfigurationType"/>
</set>
</option>
</component>

注意: 在IDEA中修改workspace.xml文件后保存时内容自动消失的原因,主要是因为IDEA会自动同步workspace.xml文件,导致手动保存的修改被覆盖。具体来说,IDEA在保存文件时会自动同步workspace.xml,这会导致手动进行的修改被覆盖
解决办法:
- 使用文本编辑器打开 workspace.xml 编辑后保存
- 通过设置关闭IDEA的自动保存功能
- 打开File菜单,选择Settings
- 在Appearance & Behavior > System Settings中找到Synchronization选项
- 取消勾选"Synchronize files on frame or editor tab activation"和"Save files on frame deactivation"
2.重启IDEA,运行项目
