@ -1809,10 +1809,23 @@ support running from the command line with reloading of static files. You can us
@@ -1809,10 +1809,23 @@ support running from the command line with reloading of static files. You can us
with an external css/js compiler process if you are writing that code with higher level
tools.
The <<using-spring-boot.adoc#using-boot-devtools,`spring-boot-devtools`>> module is also
available with support for fast application restarts and LiveReload.
[[howto-reload-thymeleaf-template-content]]
=== Reload templates without restarting the container
Most of the templating technologies supported by Spring Boot include a configuration
option to disable caching (see below for details). If you're using the
`spring-boot-devtools` module these properties will be
@ -731,11 +731,290 @@ You might also want to use this useful operating system environment variable:
@@ -731,11 +731,290 @@ You might also want to use this useful operating system environment variable:
=== Hot swapping
Since Spring Boot applications are just plain Java applications, JVM hot-swapping should
work out of the box. JVM hot swapping is somewhat limited with the bytecode that it can
replace, for a more complete solution the
https://github.com/spring-projects/spring-loaded[Spring Loaded] project, or
http://zeroturnaround.com/software/jrebel/[JRebel] can be used.
replace, for a more complete solution
http://zeroturnaround.com/software/jrebel/[JRebel] or the
https://github.com/spring-projects/spring-loaded[Spring Loaded] project can be used. The
`spring-boot-devtools` module also includes support for quick application restarts.
See the <<howto.adoc#howto-hotswapping, Hot swapping "`How-to`">> section for details.
See the <<using-boot-devtools>> section below and the
<<howto.adoc#howto-hotswapping, Hot swapping "`How-to`">> for details.
[[using-boot-devtools]]
== Developer tools
Spring Boot includes an additional set of tools that can make the application
development experience a little more pleasant. The `spring-boot-devtools` module can be
included in any project to provide additional development-time features. To include
devtools support, simply add the module dependency to your build:
2015-06-10 18:25:06.632 INFO 14938 --- [ main] o.s.b.devtools.RemoteSpringApplication : Starting RemoteSpringApplication on pwmbp with PID 14938 (/Users/pwebb/projects/spring-boot/code/spring-boot-devtools/target/classes started by pwebb in /Users/pwebb/projects/spring-boot/code/spring-boot-samples/spring-boot-sample-devtools)
2015-06-10 18:25:06.671 INFO 14938 --- [ main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@2a17b7b6: startup date [Wed Jun 10 18:25:06 PDT 2015]; root of context hierarchy
2015-06-10 18:25:07.043 WARN 14938 --- [ main] o.s.b.d.r.c.RemoteClientConfiguration : The connection to http://localhost:8080 is insecure. You should use a URL starting with 'https://'.
2015-06-10 18:25:07.074 INFO 14938 --- [ main] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2015-06-10 18:25:07.130 INFO 14938 --- [ main] o.s.b.devtools.RemoteSpringApplication : Started RemoteSpringApplication in 0.74 seconds (JVM running for 1.105)
----
NOTE: Because the remote client is using the same classpath as the real application it
can directly read application properties. This is how the `spring.devtools.remote.password`
property is read and passed to the server for authentication.
TIP: It's always advisable to use `https://` as the connection protocol so that traffic is
encrypted and passwords cannot be intercepted.
[[using-boot-devtools-remote-update]]
==== Remote update
The remote client will monitor your application classpath for changes in the same way as
the <<using-boot-devtools-restart,local restart>>. Any updated resource will be pushed
to the remote application and _(if required)_ trigger a restart. This can be quite helpful
if you are iterating on a feature that uses a cloud service that you don't have locally.
Generally remote updates and restarts are much quicker than a full rebuild and deploy
cycle.
NOTE: Files are only monitored when the remote client is running. If you change a file
before starting the remote client, it won't be pushed to the remote server.
[[using-boot-devtools-remote-debugtunnel]]
==== Remote debug tunnel
Java remote debugging is useful tool when diagnosing issues on a remote application.
Unfortunately, it's not always possible to enable remote debugging when your application
is deployed outside of your data center. Remote debugging can also be tricky to setup if
you are using a container based technology such as Docker.
To help work around these limitations, devtools supports tunneling of remote debug traffic
over HTTP. The remote client provides a local server on port `8000` that you can attach
a remote debugger to. Once a connection is established, debug traffic is sent over HTTP
to the remote application. You can use the `spring.devtools.remote.debug.local-port`
property if you want to use a different port.
You'll need to ensure that your remote application is started with remote debugging
enabled. Often this can be achieved by configuring `JAVA_OPTS`. For example, with
Cloud Foundry you can add the following to your `manifest.yml`: