From 19fa5b9af68bbafed8bc9400aaae9ada8fd40c19 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 29 Nov 2013 07:39:24 +0000 Subject: [PATCH] Updated howtos --- docs/howto.md | 37 +++++++++++++++++++ .../src/main/resources/application.properties | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/docs/howto.md b/docs/howto.md index 86a1c71f236..31c6a06a981 100644 --- a/docs/howto.md +++ b/docs/howto.md @@ -43,8 +43,44 @@ Javadocs. Some rules of thumb: ## Configure Tomcat +Generally you can follow the advice [here](#discover.options) about +`@ConfigurationProperties` (`ServerProperties` is the main one here), +but also look at `EmbeddedServletContainerCustomizer` and various +Tomcat specific `*Customizers` that you can add in one of those. The +Tomcat APIs are quite rich so once you have access to the +`TomcatEmbeddedServletContainerFactory` you can modify it in a number +of ways. Or the nuclear option is to add your own +`TomcatEmbeddedServletContainerFactory`. + ## Configure Jetty +Generally you can follow the advice [here](#discover.options) about +`@ConfigurationProperties` (`ServerProperties` is the main one here), +but also look at `EmbeddedServletContainerCustomizer`. The Jetty APIs +are quite rich so once you have access to the +`JettyEmbeddedServletContainerFactory` you can modify it in a number +of ways. Or the nuclear option is to add your own +`JettyEmbeddedServletContainerFactory`. + +## Reload Static Content (E.g. Thymeleaf Templates) Without Restarting the Container + +If you are using Thymeleaf, then set +`spring.thymeleaf.cache=false`. See `ThymeleafAutoConfiguration` for +other template customization options. + +# Reload Java Classes Without Restarting the Container + +Modern IDEs (Eclipse, IDEA etc.) all support hot swapping of bytecode, +so if you make a change that doesn't affect class or method signatures +it should reload cleanly with no side effects. + +[Spring Loaded](https://github.com/spring-projects/spring-loaded) goes +a little further in that it can reload class definitions with changes +in the method signatures. With some customization it can force an +`ApplicationContext` to refresh itself (but there is no general +mechanism to ensure that would be safe for a running application +anyway, so it would only ever be a development time trick probably). + ## Build an ApplicationContext Hierarchy (Adding a Parent or Root Context) @@ -325,6 +361,7 @@ to load an `ApplicationContext` via a `DispatcherServlet`. TODO: add some detail. + ## Discover Built-in Options for External Properties Spring Boot binds external properties from `application.properties` diff --git a/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties b/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties index 9c473745e50..6665cd62d35 100644 --- a/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties +++ b/spring-boot-samples/spring-boot-sample-web-ui/src/main/resources/application.properties @@ -1,4 +1,4 @@ # Allow Thymeleaf templates to be reloaded at dev time -spring.template.cache: false +spring.thymeleaf.cache: false server.tomcat.access_log_enabled: true server.tomcat.basedir: target/tomcat \ No newline at end of file