【问题标题】:Intellij reports error 'cannot autwire beans of type `HttpServletRequest` type found'Intellij 报告错误“无法自动连接类型为 `HttpServletRequest` 类型的 bean”
【发布时间】:2018-05-14 17:13:47
【问题描述】:

IntelliJ IDEA (2017.2.6) 在我的一项服务的自动装配构造函数中报告错误,它无法自动装配HttpServletRequest。但是,我的应用程序运行良好,并且请求自动连接非常好。这可能是 IntelliJ 中的一个错误,还是尽管没有为它定义 @Bean,但自动装配是否有效?

注意,我不想抑制这些错误,因为它们对所有其他自动装配的 bean 都正常工作。

我的构造函数如下所示:

@Autowired
public MyOtherService(HttpServletRequest request, @Lazy MyService myService) {
  this.myService = myService;
  this.currentRequest = request;
}

【问题讨论】:

标签: java spring intellij-idea


【解决方案1】:

此问题已在最新版本的 IntelliJ IDEA (2017.3) 中得到解决

见:https://www.jetbrains.com/idea/whatsnew/#v2017-3

【讨论】:

    猜你喜欢
    • 2020-05-13
    • 2020-01-31
    • 2016-12-13
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    • 2019-08-17
    • 2021-07-02
    • 2020-08-31
    相关资源
    最近更新 更多