spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
74.56k stars 40.55k forks source link

LiveReload does not detect changes #38538

Closed vanuatoo closed 9 months ago

vanuatoo commented 10 months ago

Created a 3.2 spring boot project using start.spring.io with maven and Java 21.

Added spring-boot-devtools module and in the console after running mvn spring-boot:run, I see LiveReload server is running on port 35729

But when make changes to my RestController, it's not picked up

OS is Mac OS Sonoma on M1

wilkinsona commented 10 months ago

Can you please explain what you mean by "it's not picked up"? I'm also not clear on the connection between your REST controller and LiveReload. Are you using a browser with a live reload plugin and expecting your browser to do something when you change the REST controller? If so, we'll need some more information about how your web page interacts with the controller.

vanuatoo commented 10 months ago

This is purely back-end application. My expectation is that when I have spring boot application running with LiveReload on, and I save changes in my RestController, Tomcat automatically redeploys my application and when I make a REST call, I see changes.

wilkinsona commented 10 months ago

LiveReload doesn't matter here. DevTools should be sufficient for the application to be restarted when a noticeable change is made. For a change to be noticeable it has to be compiled. You can learn more about this in the reference documentation. We generally recommend using an IDE to both to run the application and to make changes. It will then compile the changes so that they can be noticed by DevTools.

Please let us know how you get on after following the above advice.

MaksimoRamaj commented 10 months ago

If you are using intelliJ go to Settings->compiler->build project automatically, apply changes then search by for Registry by pressing two times shift ,inside registry check compiler.automake.allow.when.app.running, apply changes and see if it will work!

vanuatoo commented 9 months ago

I enabled Compile on Save in my IDE (NetBeans) and it worked. I thought it would work like in Quarkus