0

我在使用Spring-Boot-Devtools. 每次我更新我的控制器类时,spring 都找不到使用构造函数注入注入的依赖项。

假设我有这门课

class MyController{

  private MyService myService;

  public MyController(MyService myService){    
    this.myService= myService;
  }   

  //controller methods

}

对任何控制器方法或MyService's 方法的更改都会导致一些错误,例如:constructor in com.example.MyController required a bean of type 'com.example.MyService' that could not be found

而如果我在 Eclipse 上运行相同的代码,实时重新加载工作正常。

IntelliJ IDEA 2019.1.2 (Ultimate Edition)
JRE: 1.8.0_202-release-1483-b49 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains sro
macOS 10.13.6

毕业典礼 在此处输入图像描述

4

0 回答 0