I looked at many articles and questions on the Web about spring-boot-devtools
, but still can't figure out why it is not working for me. Every time I run my app, 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 I should try adding spring.devtools.restart.additional-paths=/src
to my application properties file. Using /src
will not work because it will think it's an absolute path, so I changed it to just src
. After doing that, adding a new endpoint to my controller file and saving it triggered a Spring Boot restart. 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 my controller?
I am using Spring Boot 1.5.4 with the following in my 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 app has the following structure:
build/
src/
main/
java/
com/
example/
something/
controllers/
MyController.java
SomethingApplication.java
resources/
application.yml
test/
...
My application.yml
includes
spring:
devtools:
restart:
enabled: true
additional-paths: src