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 d25b322d64d..856428ba984 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 @@ -25,7 +25,6 @@ import javax.servlet.Servlet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnNotWebApplication; @@ -42,7 +41,6 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.ui.freemarker.FreeMarkerConfigurationFactoryBean; import org.springframework.util.Assert; -import org.springframework.web.servlet.view.freemarker.FreeMarkerConfig; import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer; import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; @@ -145,14 +143,6 @@ public class FreeMarkerAutoConfiguration implements EnvironmentAware { return freeMarkerConfigurer; } - @Bean - @ConditionalOnBean(FreeMarkerConfigurer.class) - @ConditionalOnMissingBean - public freemarker.template.Configuration freemarkerConfiguration( - FreeMarkerConfig configurer) { - return configurer.getConfiguration(); - } - @Bean @ConditionalOnMissingBean(name = "freeMarkerViewResolver") public FreeMarkerViewResolver freeMarkerViewResolver() { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java index 38be24babb8..0291ecb5b25 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java @@ -191,10 +191,10 @@ public class FreeMarkerAutoConfigurationTests { public void renderTemplate() throws Exception { this.context.register(FreeMarkerAutoConfiguration.class); this.context.refresh(); - freemarker.template.Configuration freemarker = this.context - .getBean(freemarker.template.Configuration.class); + FreeMarkerConfigurer freemarker = this.context + .getBean(FreeMarkerConfigurer.class); StringWriter writer = new StringWriter(); - freemarker.getTemplate("message.ftl").process(this, writer); + freemarker.getConfiguration().getTemplate("message.ftl").process(this, writer); assertTrue("Wrong content: " + writer, writer.toString().contains("Hello World")); }