Skip to content

Make it easier to tell that DevTools restart has been disabled due to HotSwapAgent being present #14492

@danielpgross

Description

@danielpgross

Testing using a simple spring-boot starter generated by initializr: Download starter

With identical JDKs and maven versions, devtools works fine on Ubuntu 16.04 but does not work on macOS 10.13.6. The symptoms are:

  1. The main thread is called main instead of restartedMain.
  2. The application does not restart automatically (even though it should) upon changes to files in the classpath.

I have tested this going back to older versions and determined that the first version in which this broke is 1.5.3.

To reproduce:

  1. Download starter
  2. Unzip the starter and cd into the unzipped directory.
  3. Run mvn spring-boot:run

Testcases below:
macOS

$ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T14:33:14-04:00)
Maven home: /usr/local/Cellar/maven/3.5.4/libexec
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/jdk1.8.0_181.jdk/Contents/Home/jre
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"
[INFO] --- spring-boot-maven-plugin:1.5.16.RELEASE:run (default-cli) @ demo ---
[INFO] Attaching agents: []
09:24:58.767 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
09:24:58.770 [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/]
09:24:58.771 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/Users/danielgross/volatile/Downloads/demo-1516/demo/target/classes/]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.16.RELEASE)

2018-09-17 09:24:59.169  INFO 7807 --- [           main] com.example.demo.DemoApplication         : Starting DemoApplication on daniel with PID 7807 (/Users/danielgross/volatile/Downloads/demo-1516/demo/target/classes started by danielgross in /Users/danielgross/volatile/Downloads/demo-1516/demo)
2018-09-17 09:24:59.170  INFO 7807 --- [           main] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2018-09-17 09:24:59.217  INFO 7807 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@49c43f4e: startup date [Mon Sep 17 09:24:59 EDT 2018]; root of context hierarchy
2018-09-17 09:24:59.694  INFO 7807 --- [           main] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2018-09-17 09:24:59.717  INFO 7807 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-09-17 09:24:59.730  INFO 7807 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 0.989 seconds (JVM running for 1.268)
2018-09-17 09:24:59.731  INFO 7807 --- [       Thread-6] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@49c43f4e: startup date [Mon Sep 17 09:24:59 EDT 2018]; root of context hierarchy
2018-09-17 09:24:59.733  INFO 7807 --- [       Thread-6] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

Ubuntu

$ mvn -v
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T18:33:14Z)
Maven home: /opt/apache-maven
Java version: 1.8.0_181, vendor: Oracle Corporation, runtime: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: ANSI_X3.4-1968
OS name: "linux", version: "4.4.0-1065-aws", arch: "amd64", family: "unix"
[INFO] --- spring-boot-maven-plugin:1.5.16.RELEASE:run (default-cli) @ demo ---
[INFO] Attaching agents: []
13:28:13.786 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : []
13:28:13.795 [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/]
13:28:13.795 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/home/ubuntu/demo/target/classes/]

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.16.RELEASE)

2018-09-17 13:28:14.384  INFO 11885 --- [  restartedMain] com.example.demo.DemoApplication         : Starting DemoApplication on demo with PID 11885 (/home/ubuntu/demo/target/classes started by ubuntu in /home/ubuntu/demo)
2018-09-17 13:28:14.388  INFO 11885 --- [  restartedMain] com.example.demo.DemoApplication         : No active profile set, falling back to default profiles: default
2018-09-17 13:28:14.541  INFO 11885 --- [  restartedMain] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@3832139c: startup date [Mon Sep 17 13:28:14 UTC 2018]; root of context hierarchy
2018-09-17 13:28:15.815  INFO 11885 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2018-09-17 13:28:15.871  INFO 11885 --- [  restartedMain] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-09-17 13:28:15.909  INFO 11885 --- [  restartedMain] com.example.demo.DemoApplication         : Started DemoApplication in 2.081 seconds (JVM running for 2.643)
2018-09-17 13:28:15.918  INFO 11885 --- [       Thread-8] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@3832139c: startup date [Mon Sep 17 13:28:14 UTC 2018]; root of context hierarchy
2018-09-17 13:28:15.923  INFO 11885 --- [       Thread-8] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions