Cannot find declaration to go to solution

Using IDEA, when using @Autowired, @Qualifier to inject a class, try ctrl + left mouse button to enter the class, prompting "Cannot find declaration to go to" or "Cannot find bean with qualifier '********'" . The author concludes that the solutions are as follows:

1 When importing a project, Open is used instead of Import Project.

 File–>close project 重启IDEA,并重新import项目; 

2 Check the pom file configuration to confirm whether the corresponding jar path is imported

3 Clear the cache

File --> Invalidate Caches / Restart ,重启IDEA;

4 Mark resource directory

右键项目名,Mark Directory as --> Sources Root。

5 If it is a dependent package, re-import the dependency.

   右侧maven窗口,Maven --> 选中模块,右键 --> Reimport
   或者:
   右键项目名,Maven --> Reimport。

6 Add scanBasePackages to the annotation @SpringBootApplication in the startup class, and the value is the path where the class is located:

 @SpringBootApplication(scanBasePackageClasses = {
	*.class,
	*.class},
	scanBasePackages = "com.*.*.*")

Supongo que te gusta

Origin blog.csdn.net/helloworldchina/article/details/108331415
Recomendado
Clasificación