diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index 2074ad54bd2..890384ec4f1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -49,7 +49,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; */ @Configuration @ConditionalOnClass(freemarker.template.Configuration.class) -@ConditionalOnWebApplication @AutoConfigureAfter(WebMvcAutoConfiguration.class) public class FreeMarkerAutoConfiguration { @@ -60,7 +59,7 @@ public class FreeMarkerAutoConfiguration { public static final String DEFAULT_SUFFIX = ".ftl"; @Configuration - public static class FreemarkerConfigurerConfiguration implements EnvironmentAware { + public static class FreeMarkerConfigurerConfiguration implements EnvironmentAware { @Autowired private final ResourceLoader resourceLoader = new DefaultResourceLoader(); @@ -105,14 +104,15 @@ public class FreeMarkerAutoConfiguration { @Configuration @ConditionalOnClass(Servlet.class) - public static class FreemarkerViewResolverConfiguration implements EnvironmentAware { + @ConditionalOnWebApplication + public static class FreeMarkerViewResolverConfiguration implements EnvironmentAware { private RelaxedPropertyResolver environment; @Override public void setEnvironment(Environment environment) { this.environment = new RelaxedPropertyResolver(environment, - "spring.freeMarker."); + "spring.freemarker."); } @Bean @@ -135,7 +135,7 @@ public class FreeMarkerAutoConfiguration { resolver.setAllowSessionOverride(this.environment.getProperty( "allowSessionOverride", Boolean.class, false)); resolver.setExposeSpringMacroHelpers(this.environment.getProperty( - "exposeSpringMacroHelpers", Boolean.class, false)); + "exposeSpringMacroHelpers", Boolean.class, true)); resolver.setRequestContextAttribute(this.environment .getProperty("requestContextAttribute")); diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml b/spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml index 569a9af73b3..8bbf0b278f1 100644 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/pom.xml @@ -25,7 +25,7 @@ org.springframework.boot - spring-boot-starter-thymeleaf + spring-boot-starter-freemarker org.springframework.boot diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.ftl b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.ftl new file mode 100644 index 00000000000..472b390a4eb --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.ftl @@ -0,0 +1,32 @@ +<#import "/spring.ftl" as spring /> + + + +Error +<#assign home><@spring.url relativeUrl="/"/> +<#assign bootstrap><@spring.url relativeUrl="/css/bootstrap.min.css"/> + + + +
+ +

Error Page

+
${timestamp?datetime}
+
+ There was an unexpected error (type=${error}, status=${status}). +
+
${message}
+
+ Please contact the operator with the above information. +
+
+ + diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.html b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.html deleted file mode 100644 index baa9677cac5..00000000000 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/error.html +++ /dev/null @@ -1,31 +0,0 @@ - - - -Error - - - -
- -

Title

-
July 11, - 2012 2:17:16 PM CDT
-
- There was an unexpected error (type=Bad, status=500). -
-
Fake content
-
- Please contact the operator with the above information. -
-
- - diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.ftl b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.ftl new file mode 100644 index 00000000000..fb648106603 --- /dev/null +++ b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.ftl @@ -0,0 +1,26 @@ +<#import "/spring.ftl" as spring /> + + + +${title} +<#assign home><@spring.url relativeUrl="/"/> +<#assign bootstrap><@spring.url relativeUrl="/css/bootstrap.min.css"/> + + + +
+ +

${title}

+
${message}
+
${date?datetime}
+
+ + diff --git a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.html b/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.html deleted file mode 100644 index 2ec60a60dab..00000000000 --- a/spring-boot-samples/spring-boot-sample-actuator-ui/src/main/resources/templates/home.html +++ /dev/null @@ -1,25 +0,0 @@ - - - -Title - - - -
- -

Title

-
Fake content
-
July 11, - 2012 2:17:16 PM CDT
-
- -