From f21151e59478669e96c969e5bcdff1c0eceefce1 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 23 May 2014 11:36:14 +0100 Subject: [PATCH] =?UTF-8?q?Dont=E2=80=99t=20auto-configure=20FreeMarker=20?= =?UTF-8?q?and=20Velocity=20without=20context-support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Boot’s auto-configuration for FreeMarker and Velocity relies on Spring’s support for them that’s packaged in spring-context-support. Only auto-configure them if their respective Spring classes are on the classpath Fixes #940 --- .../freemarker/FreeMarkerAutoConfiguration.java | 5 +++-- .../autoconfigure/velocity/VelocityAutoConfiguration.java | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) 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 1b8970cea5e..5d9dc804061 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 @@ -44,13 +44,14 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; /** * {@link EnableAutoConfiguration Auto-configuration} for FreeMarker. - * + * * @author Andy Wilkinson * @author Dave Syer * @since 1.1.0 */ @Configuration -@ConditionalOnClass(freemarker.template.Configuration.class) +@ConditionalOnClass({ freemarker.template.Configuration.class, + FreeMarkerConfigurationFactory.class }) @AutoConfigureAfter(WebMvcAutoConfiguration.class) @EnableConfigurationProperties(FreeMarkerProperties.class) public class FreeMarkerAutoConfiguration { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java index af24278e979..627aa41f4d3 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/velocity/VelocityAutoConfiguration.java @@ -47,12 +47,12 @@ import org.springframework.web.servlet.view.velocity.VelocityViewResolver; /** * {@link EnableAutoConfiguration Auto-configuration} for Velocity. - * + * * @author Andy Wilkinson * @since 1.1.0 */ @Configuration -@ConditionalOnClass(VelocityEngine.class) +@ConditionalOnClass({ VelocityEngine.class, VelocityEngineFactory.class }) @AutoConfigureAfter(WebMvcAutoConfiguration.class) @EnableConfigurationProperties(VelocityProperties.class) public class VelocityAutoConfiguration {