在搭建Springboot项目中发现使用注解@Autowired 会提示类似报错的红色下划线,但是项目编译没问题,虽然不影响使用,但是看着未免难受:

@RequestMapping("/cms")
@RestController
public class MemberController {

    @Autowired
    private WeiXinService weiXinService;
    @Autowired
    private AuthenticationService authenticationService;

    private Logger logger = LoggerFactory.getLogger(MemberController.class);
    ...
    ...
}

网上有人说 删除facets下spring就可以了,但是仔细分析,这应该只是提示方面的问题,应该修改下配置就好;经过查找最后发现比较合适的方法:
Preferences -> Editor -> Inspections -> Spring -> Severtiy

IDEA-springboot项目报错could not autowire

在设置里面修改spring的检验等级就好了,这里改为Warning。

相关文章:

  • 2021-07-02
  • 2021-07-04
  • 2021-10-29
  • 2021-07-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-07-13
猜你喜欢
  • 2021-06-23
  • 2021-06-21
  • 2021-05-25
  • 2021-10-14
  • 2021-04-23
  • 2022-01-19
  • 2021-04-19
相关资源
相似解决方案