3

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
nbkhope
  • 7,360
  • 4
  • 40
  • 58

2 Answers2

0

Please check the paths provided in application.yml OR in logback-spring.xml file.

For example: LOG_HOME in your logback is configured as E:/logs but there is no E:/ drive in your laptop/desktop.

Due to this the matching url is not found and the processing stops.

I also got the same problem and I corrected the path in logback-spring.xml file.

Thank you !

Regards, Anurag

Anurag
  • 843
  • 1
  • 9
  • 16
-4

Spring Boot Developer Tools: Automatic Restart

Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change. This can be a useful feature when working in an IDE as it gives a very fast feedback loop for code changes.

This feature requires the use of an IDE.

Kyle Anderson
  • 6,801
  • 1
  • 29
  • 41
  • 1
    This feature requires changes in the classpath. No **IDE** is required. The compilation just needs to put the `*.class` files in the classpath. So using Gradle, the compilation output must be correctly configured. – YoannFleuryDev Sep 21 '17 at 17:24