有人碰到过这种问题吗?
不修改idea检测怎么把这个黄色区域去掉?
让阿豪来帮你解答,本回答参考chatgpt3.5编写提供,如果还有疑问可以评论或留言问题描述: 有人碰到过这种问题吗?
@RestController
public class HelloController {
@Autowired
private HelloService helloService;
@GetMapping("/hello")
public String hello() {
return helloService.sayHello();
}
}
这时,idea会在@Autowired注解上面显示黄色的波浪线,表示这里可以使用构造函数注入替代,可点击黄色波浪线查看建议: 如果我们按照上面的步骤将@Autowired Annotation检查项取消勾选,再刷新一下项目,就可以发现黄色波浪线消失了: 代码: 取消勾选操作的代码如下:
@Override
public void actionPerformed(AnActionEvent e) {
Application application = ApplicationManager.getApplication();
InspectionProfileManager inspectionProfileManager = InspectionProfileManager.getInstance();
InspectionProfileImpl springProfile = (InspectionProfileImpl)inspectionProfileManager.getProfile("Spring");
InspectionToolRegistrar toolRegistrar = InspectionToolRegistrar.getInstance();
InspectionProfileEntry inspectionProfileEntry = springProfile.getInspectionTool("Spring Core", toolRegistrar);
if (inspectionProfileEntry instanceof GroupInspectionTool) {
GroupInspectionTool groupInspectionTool = (GroupInspectionTool)inspectionProfileEntry;
InspectionToolWrapper inspectionToolWrapper = (InspectionToolWrapper)groupInspectionTool.getToolWrappers().get("Autowired Annotation");
inspectionToolWrapper.setEnabled(false);
inspectionProfileManager.fireProfileChanged(springProfile);
((EditorNotificationsManagerImpl)EditorNotificationsManager.getInstance(myProject)).updateAllNotifications();
}
}