0

I am facing hard time in the live reload using Spring-Boot-Devtools. Every time I update my controller class, the spring couldn't find the dependencies which are injected using constructor injection.

Suppose I am having this class

class MyController{

  private MyService myService;

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

  //controller methods

}

Changes to any of the controller methods or the MyService's methods would result in some error like: constructor in com.example.MyController required a bean of type 'com.example.MyService' that could not be found

Whereas if I run the same code on the Eclipse, the live reload works fine.

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 s.r.o
macOS 10.13.6

gradle enter image description here

The Coder
  • 3,447
  • 7
  • 46
  • 81
  • Do you have [build/run delegated to Gradle](https://i.imgur.com/AmWjMZR.png)? Does it help if you switch this option to IntelliJ IDEA? – CrazyCoder Sep 11 '19 at 16:34
  • @CrazyCoder I don't have such options into my Gradle settings. Please see the updated question for screenshots. – The Coder Sep 11 '19 at 17:25
  • Is your project Maven based? Can you share [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) so that we can reproduce the issue? – CrazyCoder Sep 11 '19 at 17:28
  • Yes, it's a maven project. I think I can't provide you a sample project. I tried creating a sample project, but live-reload is working fine there. May be my original project is quite heavy. I can't recreate that whole project for the issue to be reproduced, sorry. – The Coder Sep 11 '19 at 18:30
  • @CrazyCoder Can you please suggest some other configs I can check in my project? – The Coder Sep 12 '19 at 03:04
  • Sorry, can't help without MCVE. – CrazyCoder Sep 12 '19 at 04:12
  • @CrazyCoder I somehow manage to create a sample project and pushed it to GitHub. Please clone it from here https://github.com/Puspendert/intellij-liveReload.git. Also created a screen recording which will help you understand the issue better. here is the link https://drive.google.com/open?id=1Au7pIPTHozyc8XUznb3cpF1QH8Vavc-A – The Coder Sep 12 '19 at 17:01
  • Can't reproduce in 2019.2.2 release. How do you update the classes? Do you run Build | Build? – CrazyCoder Sep 12 '19 at 19:34
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/199390/discussion-between-thecoder-and-crazycoder). – The Coder Sep 12 '19 at 22:17

0 Answers0