一直这个错误:

------------------------------------------------- 下面的方法试了,不行。。。
明明就在一个包里面的类,引用的时候都出现了红色错误,无法导入类。
或者其他的不可思议的错误。
可以试试“清除缓存重启”:
第一步:菜单中选择file->invalidate caches / restart

第二步:在弹出框中选择Invalidate and Restart。idea关闭并且自动重启,重启后问题解决。

如果idea出现类似的不合逻辑的错误,很有可能是缓存导致,试试“清除缓存重启”!
----------------------------------------------------- 后面终于发现问题, 原来是 maven的打包问题, thin jar 打包成了 fat jar
下面的 jar 的大小, 明显不对, 怎么可能59M ? 明显是 fat jar 的节奏

去掉 spring-boot-maven-plugin 就可以引入了!
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.2</version>
<!-- <version>${spring-boot.version}</version>-->
<configuration>
<mainClass>com.test.sad.JavaGateApplication</mainClass>
<jvmArguments>-Xms256M -Xmx1024M -XX:+UseConcMarkSweepGC</jvmArguments>
<executable>true</executable>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
over !