Spring Boottools reload not working automatically with Spring Boot 1.5.4
I have looked through many articles and questions on the internet about spring-boot-devtools
but still can't figure out why it doesn't work for me. Every time I run my application I get the following:
17:54:28.057 [main] DEBUG
org.springframework.boot.devtools.settings.DevToolsSettings
- Included patterns for restart : []
17:54:28.066 [main] DEBUG
org.springframework.boot.devtools.settings.DevToolsSettings
- Excluded patterns for restart : [/spring-boot-starter/target/classes/,
/spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/,
/spring-boot/target/classes/, /spring-boot-actuator/target/classes/,
/spring-boot-devtools/target/classes/]
17:54:28.069 [main] DEBUG
org.springframework.boot.devtools.restart.ChangeableUrls - Matching
URLs for reloading : [file:/some/where/build/classes/main/,
file:/some/where/build/resources/main/]
Whenever I changed one of my controller files, nothing happened. So I came across an article that mentioned that I should try adding spring.devtools.restart.additional-paths=/src
to the application properties file. Usage /src
won't work because it will take absolute path, so I changed it to src
. After that, by adding a new endpoint to my controller file and saving it, restart your Spring reboot. However, I got a 404 for the endpoint, which will only work if I manually restart the server.
How can I make Spring boot restart and allow me to see the actual changes I made to the controller?
I am using Spring Boot 1.5.4 with the following in build.gradle
:
dependencies {
// ...
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile('org.springframework.boot:spring-boot-starter-web')
compile('org.springframework.boot:spring-boot-devtools')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
My application has the following structure:
build/
src/
main/
java/
com/
example/
something/
controllers/
MyController.java
SomethingApplication.java
resources/
application.yml
test/
...
Mine application.yml
includes
spring:
devtools:
restart:
enabled: true
additional-paths: src
source to share
Please check the paths specified in application.yml OR in the logback-spring.xml file.
For example: LOG_HOME in your logback is configured as E: / logs, but there is no E: / drive on your laptop / desktop.
As a result, no matching URL was found and processing stops.
I also got the same problem and I fixed the path in the logback-spring.xml file.
Thank !
Regards, Anurag
source to share
Spring Boot Developer Tools: Automatic Restart
The applications that are using
spring-boot-devtools
will automatically reload whenever the files in the class change. This can be a useful feature when working in an IDE as it provides a very fast feedback loop for the change code.
This feature requires the use of an IDE .
source to share