As I am preparing a demo with some Spring Boot applications running simultaneously and need to restart on-the-fly when I changed some settings in IntelliJ, I came to a point where randomly one of the apps did not autowire the Controller anymore. So what is going on?

After searching with my friend Google, I found the following post at our other friend, StackOverflow:
https://stackoverflow.com/questions/39019938/springboot-devtools-restcontroller-not-always-mapped-when-rebuild-project

It appears that this is a timing issue; the application is reloaded faster than the classes are re-generated (or something like that).

The solution for me was also offered over there; adding this to your properties:

# Amount of time (in milliseconds) to wait between polling for classpath changes.
spring.devtools.restart.poll-interval=3000

# Amount of quiet time (in milliseconds) required without any classpath changes before a restart is triggered.
spring.devtools.restart.quiet-period=2999

Still quite interesting how such timing issues may happen. Will explore it further in some spare time.

 

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *