From 855b6a6facc126deb8837d9578d65c39c2bbcdbb Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Wed, 19 Mar 2025 15:00:24 +0100 Subject: [PATCH] Create spring-boot-freemarker module Closes gh-46090 --- settings.gradle | 1 + .../build.gradle | 2 +- ...itional-spring-configuration-metadata.json | 36 --------------- .../main/resources/META-INF/spring.factories | 1 - ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../BasicErrorControllerIntegrationTests.java | 2 +- .../spring-boot-dependencies/build.gradle | 1 + .../spring-boot-devtools/build.gradle | 2 +- .../LocalDevToolsAutoConfigurationTests.java | 2 +- .../spring-boot-docs/build.gradle | 2 + .../spring-boot-freemarker/build.gradle | 42 +++++++++++++++++ .../AbstractFreeMarkerConfiguration.java | 2 +- .../FreeMarkerAutoConfiguration.java | 4 +- .../FreeMarkerNonWebConfiguration.java | 2 +- .../autoconfigure}/FreeMarkerProperties.java | 4 +- .../FreeMarkerReactiveWebConfiguration.java | 7 +-- .../FreeMarkerServletWebConfiguration.java | 5 +-- ...reeMarkerTemplateAvailabilityProvider.java | 4 +- .../FreeMarkerVariablesCustomizer.java | 4 +- .../autoconfigure}/package-info.java | 2 +- ...itional-spring-configuration-metadata.json | 45 +++++++++++++++++++ .../main/resources/META-INF/spring.factories | 3 ++ .../resources/META-INF/spring/aot.factories | 2 +- ...ot.autoconfigure.AutoConfiguration.imports | 1 + ...ConfigurationReactiveIntegrationTests.java | 2 +- ...oConfigurationServletIntegrationTests.java | 2 +- .../FreeMarkerAutoConfigurationTests.java | 22 ++++----- .../FreeMarkerPropertiesTests.java | 2 +- ...rkerTemplateAvailabilityProviderTests.java | 6 +-- .../build.gradle | 3 +- .../build.gradle | 1 + ....web.reactive.AutoConfigureWebFlux.imports | 4 +- ...re.web.servlet.AutoConfigureWebMvc.imports | 4 +- ...TestAutoConfigurationIntegrationTests.java | 2 +- ...TestAutoConfigurationIntegrationTests.java | 2 +- 35 files changed, 139 insertions(+), 88 deletions(-) create mode 100644 spring-boot-project/spring-boot-freemarker/build.gradle rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/AbstractFreeMarkerConfiguration.java (97%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerAutoConfiguration.java (97%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerNonWebConfiguration.java (96%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerProperties.java (99%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerReactiveWebConfiguration.java (90%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerServletWebConfiguration.java (94%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerTemplateAvailabilityProvider.java (97%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerVariablesCustomizer.java (94%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure}/package-info.java (91%) create mode 100644 spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/additional-spring-configuration-metadata.json create mode 100644 spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring.factories rename spring-boot-project/{spring-boot-autoconfigure-all => spring-boot-freemarker}/src/main/resources/META-INF/spring/aot.factories (65%) create mode 100644 spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerAutoConfigurationReactiveIntegrationTests.java (98%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerAutoConfigurationServletIntegrationTests.java (99%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerAutoConfigurationTests.java (83%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerPropertiesTests.java (97%) rename spring-boot-project/{spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker => spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure}/FreeMarkerTemplateAvailabilityProviderTests.java (95%) diff --git a/settings.gradle b/settings.gradle index 509d019357a..90af7ebcddb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -68,6 +68,7 @@ include "spring-boot-project:spring-boot-devtools" include "spring-boot-project:spring-boot-docker-compose" include "spring-boot-project:spring-boot-docs" include "spring-boot-project:spring-boot-flyway" +include "spring-boot-project:spring-boot-freemarker" include "spring-boot-project:spring-boot-groovy-templates" include "spring-boot-project:spring-boot-jackson" include "spring-boot-project:spring-boot-jdbc" diff --git a/spring-boot-project/spring-boot-autoconfigure-all/build.gradle b/spring-boot-project/spring-boot-autoconfigure-all/build.gradle index 8ab14602362..eac7b0f5215 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/build.gradle +++ b/spring-boot-project/spring-boot-autoconfigure-all/build.gradle @@ -134,7 +134,6 @@ dependencies { } optional("org.elasticsearch.client:elasticsearch-rest-client") optional("org.elasticsearch.client:elasticsearch-rest-client-sniffer") - optional("org.freemarker:freemarker") optional("org.glassfish.jersey.containers:jersey-container-servlet-core") optional("org.glassfish.jersey.containers:jersey-container-servlet") optional("org.glassfish.jersey.core:jersey-server") @@ -235,6 +234,7 @@ dependencies { optional("org.thymeleaf.extras:thymeleaf-extras-springsecurity6") optional("redis.clients:jedis") + testImplementation(project(":spring-boot-project:spring-boot-freemarker")) testImplementation(project(":spring-boot-project:spring-boot-jetty")) testImplementation(project(":spring-boot-project:spring-boot-test")) testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json index fe29995842e..f90557a1580 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -759,42 +759,6 @@ "reason": "Reactive Elasticsearch client no longer uses WebClient." } }, - { - "name": "spring.freemarker.allow-request-override", - "description": "Whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.allow-session-override", - "description": "Whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.cache", - "description": "Whether to enable template caching. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.content-type", - "description": "Content-Type value. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.expose-request-attributes", - "description": "Whether all request attributes should be added to the model prior to merging with the template. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.expose-session-attributes", - "description": "Whether all HttpSession attributes should be added to the model prior to merging with the template. Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.expose-spring-macro-helpers", - "description": "Whether to expose a RequestContext for use by Spring's macro library, under the name \"springMacroRequestContext\". Only supported with Spring MVC." - }, - { - "name": "spring.freemarker.prefix", - "defaultValue": "" - }, - { - "name": "spring.freemarker.suffix", - "defaultValue": ".ftlh" - }, { "name": "spring.graphql.schema.file-extensions", "defaultValue": ".graphqls,.gqls" diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring.factories index dda0d42049b..26478a4d660 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring.factories +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring.factories @@ -18,7 +18,6 @@ org.springframework.boot.autoconfigure.r2dbc.NoConnectionFactoryBeanFailureAnaly # Template Availability Providers org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\ -org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider,\ org.springframework.boot.autoconfigure.mustache.MustacheTemplateAvailabilityProvider,\ org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\ org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports index 791c0715895..6c5cd59dfa4 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -36,7 +36,6 @@ org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchClientAutoConfiguration org.springframework.boot.autoconfigure.elasticsearch.ElasticsearchRestClientAutoConfiguration org.springframework.boot.autoconfigure.elasticsearch.ReactiveElasticsearchClientAutoConfiguration -org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration org.springframework.boot.autoconfigure.graphql.GraphQlAutoConfiguration org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQueryByExampleAutoConfiguration org.springframework.boot.autoconfigure.graphql.data.GraphQlReactiveQuerydslAutoConfiguration diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java b/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java index f5abcfa0ca7..b09935f087f 100755 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/error/BasicErrorControllerIntegrationTests.java @@ -39,11 +39,11 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.servlet.DispatcherServletAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 70c5d0a935f..4fe5a7346c3 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -1996,6 +1996,7 @@ bom { "spring-boot-devtools", "spring-boot-docker-compose", "spring-boot-flyway", + "spring-boot-freemarker", "spring-boot-groovy-templates", "spring-boot-jackson", "spring-boot-jarmode-tools", diff --git a/spring-boot-project/spring-boot-devtools/build.gradle b/spring-boot-project/spring-boot-devtools/build.gradle index d220ab0eff4..3929de0d16d 100644 --- a/spring-boot-project/spring-boot-devtools/build.gradle +++ b/spring-boot-project/spring-boot-devtools/build.gradle @@ -66,6 +66,7 @@ dependencies { optional("org.springframework.data:spring-data-redis") optional("org.springframework.session:spring-session-core") + testImplementation(project(":spring-boot-project:spring-boot-freemarker")) testImplementation(project(":spring-boot-project:spring-boot-test")) testImplementation(project(":spring-boot-project:spring-boot-tomcat")) testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) @@ -84,7 +85,6 @@ dependencies { testImplementation("org.springframework:spring-websocket") testImplementation("org.springframework.hateoas:spring-hateoas") testImplementation("org.springframework.security:spring-security-test") - testImplementation("org.freemarker:freemarker") testRuntimeOnly("org.aspectj:aspectjweaver") testRuntimeOnly("org.yaml:snakeyaml") diff --git a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index 461f5ef48b2..53dc40d102b 100644 --- a/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -33,7 +33,6 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebProperties; import org.springframework.boot.autoconfigure.web.WebProperties.Resources; import org.springframework.boot.devtools.classpath.ClassPathChangedEvent; @@ -43,6 +42,7 @@ import org.springframework.boot.devtools.restart.FailureHandler; import org.springframework.boot.devtools.restart.MockRestartInitializer; import org.springframework.boot.devtools.restart.MockRestarter; import org.springframework.boot.devtools.restart.Restarter; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.tomcat.TomcatWebServer; import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration; import org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext; diff --git a/spring-boot-project/spring-boot-docs/build.gradle b/spring-boot-project/spring-boot-docs/build.gradle index 9610d39c1aa..799ac48af3b 100644 --- a/spring-boot-project/spring-boot-docs/build.gradle +++ b/spring-boot-project/spring-boot-docs/build.gradle @@ -83,6 +83,7 @@ dependencies { autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure-all", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "autoConfigurationMetadata")) + autoConfiguration(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "autoConfigurationMetadata")) autoConfiguration(project(path: ":spring-boot-project:spring-boot-jetty", configuration: "autoConfigurationMetadata")) @@ -108,6 +109,7 @@ dependencies { configurationProperties(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-docker-compose", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-flyway", configuration: "configurationPropertiesMetadata")) + configurationProperties(project(path: ":spring-boot-project:spring-boot-freemarker", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-jackson", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-jdbc", configuration: "configurationPropertiesMetadata")) configurationProperties(project(path: ":spring-boot-project:spring-boot-jetty", configuration: "configurationPropertiesMetadata")) diff --git a/spring-boot-project/spring-boot-freemarker/build.gradle b/spring-boot-project/spring-boot-freemarker/build.gradle new file mode 100644 index 00000000000..3d38b012d45 --- /dev/null +++ b/spring-boot-project/spring-boot-freemarker/build.gradle @@ -0,0 +1,42 @@ +/* + * Copyright 2012-present the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +plugins { + id "java-library" + id "org.springframework.boot.auto-configuration" + id "org.springframework.boot.configuration-properties" + id "org.springframework.boot.deployed" + id "org.springframework.boot.optional-dependencies" +} + +description = "Spring Boot Freemarker" + +dependencies { + api(project(":spring-boot-project:spring-boot")) + api("org.freemarker:freemarker") + api("org.springframework:spring-context-support") + + optional(project(":spring-boot-project:spring-boot-autoconfigure")) + optional("org.springframework:spring-webmvc") + optional("org.springframework:spring-webflux") + optional("jakarta.servlet:jakarta.servlet-api") + + testImplementation(project(":spring-boot-project:spring-boot-test")) + testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) + + testRuntimeOnly("ch.qos.logback:logback-classic") +} diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/AbstractFreeMarkerConfiguration.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/AbstractFreeMarkerConfiguration.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/AbstractFreeMarkerConfiguration.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/AbstractFreeMarkerConfiguration.java index 299303eb8b1..cfb47f20acb 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/AbstractFreeMarkerConfiguration.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/AbstractFreeMarkerConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.util.HashMap; import java.util.List; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfiguration.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfiguration.java index c1dc9eec190..937c2efc05d 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.util.ArrayList; import java.util.List; @@ -37,7 +37,7 @@ import org.springframework.ui.freemarker.FreeMarkerConfigurationFactory; * @author Andy Wilkinson * @author Dave Syer * @author Kazuki Shimizu - * @since 1.1.0 + * @since 4.0.0 */ @AutoConfiguration @ConditionalOnClass({ freemarker.template.Configuration.class, FreeMarkerConfigurationFactory.class }) diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerNonWebConfiguration.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerNonWebConfiguration.java similarity index 96% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerNonWebConfiguration.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerNonWebConfiguration.java index 9331ffb7c2a..073b936cbfa 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerNonWebConfiguration.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerNonWebConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerProperties.java similarity index 99% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerProperties.java index 34f1cae729b..3dc7c27843a 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerProperties.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerProperties.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; @@ -33,7 +33,7 @@ import org.springframework.web.servlet.view.AbstractTemplateViewResolver; * * @author Dave Syer * @author Andy Wilkinson - * @since 1.1.0 + * @since 4.0.0 */ @ConfigurationProperties("spring.freemarker") public class FreeMarkerProperties { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerReactiveWebConfiguration.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerReactiveWebConfiguration.java similarity index 90% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerReactiveWebConfiguration.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerReactiveWebConfiguration.java index acd2358860e..0e5437e79e0 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerReactiveWebConfiguration.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerReactiveWebConfiguration.java @@ -14,14 +14,14 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfig; @@ -36,7 +36,8 @@ import org.springframework.web.reactive.result.view.freemarker.FreeMarkerViewRes */ @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE) -@AutoConfigureAfter(WebFluxAutoConfiguration.class) +@ConditionalOnClass(FreeMarkerConfigurer.class) +@AutoConfigureAfter(name = "org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration") class FreeMarkerReactiveWebConfiguration extends AbstractFreeMarkerConfiguration { FreeMarkerReactiveWebConfiguration(FreeMarkerProperties properties, diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerServletWebConfiguration.java similarity index 94% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerServletWebConfiguration.java index d8bedd630b3..406c0907747 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerServletWebConfiguration.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerServletWebConfiguration.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import jakarta.servlet.DispatcherType; import jakarta.servlet.Servlet; @@ -27,7 +27,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingFilterBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceChain; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -45,7 +44,7 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnClass({ Servlet.class, FreeMarkerConfigurer.class }) -@AutoConfigureAfter(WebMvcAutoConfiguration.class) +@AutoConfigureAfter(name = "org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration") class FreeMarkerServletWebConfiguration extends AbstractFreeMarkerConfiguration { protected FreeMarkerServletWebConfiguration(FreeMarkerProperties properties, diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProvider.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProvider.java index fc4172474b1..f6167d5f44b 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProvider.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProvider.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.util.ArrayList; import java.util.Arrays; @@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils; * FreeMarker view templates. * * @author Andy Wilkinson - * @since 1.1.0 + * @since 4.0.0 */ public class FreeMarkerTemplateAvailabilityProvider extends PathBasedTemplateAvailabilityProvider { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerVariablesCustomizer.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerVariablesCustomizer.java similarity index 94% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerVariablesCustomizer.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerVariablesCustomizer.java index 018f12bd9b9..15661d010f5 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerVariablesCustomizer.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerVariablesCustomizer.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.util.Map; @@ -28,7 +28,7 @@ import org.springframework.ui.freemarker.FreeMarkerConfigurationFactory; * before it is used by an auto-configured {@link FreeMarkerConfigurationFactory}. * * @author Stephane Nicoll - * @since 3.4.0 + * @since 4.0.0 */ @FunctionalInterface public interface FreeMarkerVariablesCustomizer { diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/package-info.java b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/package-info.java similarity index 91% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/package-info.java rename to spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/package-info.java index f2932fca100..0fa1da4d696 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/java/org/springframework/boot/autoconfigure/freemarker/package-info.java +++ b/spring-boot-project/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/package-info.java @@ -17,4 +17,4 @@ /** * Auto-configuration for FreeMarker. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; diff --git a/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/additional-spring-configuration-metadata.json new file mode 100644 index 00000000000..4d823ad88ee --- /dev/null +++ b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -0,0 +1,45 @@ +{ + "groups": [], + "properties": [ + { + "name": "spring.freemarker.allow-request-override", + "description": "Whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.allow-session-override", + "description": "Whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.cache", + "description": "Whether to enable template caching. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.content-type", + "description": "Content-Type value. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.expose-request-attributes", + "description": "Whether all request attributes should be added to the model prior to merging with the template. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.expose-session-attributes", + "description": "Whether all HttpSession attributes should be added to the model prior to merging with the template. Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.expose-spring-macro-helpers", + "description": "Whether to expose a RequestContext for use by Spring's macro library, under the name \"springMacroRequestContext\". Only supported with Spring MVC." + }, + { + "name": "spring.freemarker.prefix", + "defaultValue": "" + }, + { + "name": "spring.freemarker.suffix", + "defaultValue": ".ftlh" + } + ], + "hints": [], + "ignored": { + "properties": [] + } +} diff --git a/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring.factories new file mode 100644 index 00000000000..d641c14f073 --- /dev/null +++ b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +# Template Availability Providers +org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\ +org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/aot.factories b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/aot.factories similarity index 65% rename from spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/aot.factories rename to spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/aot.factories index ca3cf091a22..59f8b403374 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/aot.factories +++ b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/aot.factories @@ -1,2 +1,2 @@ org.springframework.aot.hint.RuntimeHintsRegistrar=\ -org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints +org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints diff --git a/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000000..6a71b86fac2 --- /dev/null +++ b/spring-boot-project/spring-boot-freemarker/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationReactiveIntegrationTests.java similarity index 98% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java rename to spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationReactiveIntegrationTests.java index 17188eb5ace..587f93c1d90 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationReactiveIntegrationTests.java +++ b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationReactiveIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.io.StringWriter; import java.time.Duration; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationServletIntegrationTests.java similarity index 99% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java rename to spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationServletIntegrationTests.java index 615c4c82f4a..ea710b7fd87 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationServletIntegrationTests.java +++ b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationServletIntegrationTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.io.StringWriter; import java.util.EnumSet; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationTests.java similarity index 83% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java rename to spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationTests.java index 677b82337e7..d29774f6240 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerAutoConfigurationTests.java @@ -14,19 +14,19 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; -import java.io.File; import java.io.StringWriter; +import java.nio.file.Path; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.api.io.TempDir; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.system.CapturedOutput; import org.springframework.boot.test.system.OutputCaptureExtension; -import org.springframework.boot.testsupport.BuildOutput; import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -46,8 +46,6 @@ import static org.mockito.Mockito.mock; @ExtendWith(OutputCaptureExtension.class) class FreeMarkerAutoConfigurationTests { - private final BuildOutput buildOutput = new BuildOutput(getClass()); - private final ApplicationContextRunner contextRunner = new ApplicationContextRunner() .withConfiguration(AutoConfigurations.of(FreeMarkerAutoConfiguration.class)); @@ -71,20 +69,16 @@ class FreeMarkerAutoConfigurationTests { } @Test - void emptyTemplateLocation(CapturedOutput output) { - File emptyDirectory = new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory"); - emptyDirectory.mkdirs(); - this.contextRunner - .withPropertyValues("spring.freemarker.templateLoaderPath:classpath:/empty-templates/empty-directory/") + void emptyTemplateLocation(CapturedOutput output, @TempDir Path tempDir) { + this.contextRunner.withPropertyValues("spring.freemarker.templateLoaderPath:file:" + tempDir.toAbsolutePath()) .run((context) -> assertThat(output).doesNotContain("Cannot find template location")); } @Test - void nonExistentLocationAndEmptyLocation(CapturedOutput output) { - new File(this.buildOutput.getTestResourcesLocation(), "empty-templates/empty-directory").mkdirs(); + void nonExistentLocationAndEmptyLocation(CapturedOutput output, @TempDir Path tempDir) { this.contextRunner - .withPropertyValues("spring.freemarker.templateLoaderPath:" - + "classpath:/does-not-exist/,classpath:/empty-templates/empty-directory/") + .withPropertyValues("spring.freemarker.templateLoaderPath:" + "classpath:/does-not-exist/,file:" + + tempDir.toAbsolutePath()) .run((context) -> assertThat(output).doesNotContain("Cannot find template location")); } diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerPropertiesTests.java b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerPropertiesTests.java similarity index 97% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerPropertiesTests.java rename to spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerPropertiesTests.java index f0aaf946ea2..a3ef1240cf9 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerPropertiesTests.java +++ b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerPropertiesTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import java.nio.charset.StandardCharsets; diff --git a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProviderTests.java similarity index 95% rename from spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java rename to spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProviderTests.java index e310063e597..9b44029f6e9 100644 --- a/spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerTemplateAvailabilityProviderTests.java +++ b/spring-boot-project/spring-boot-freemarker/src/test/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerTemplateAvailabilityProviderTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.boot.autoconfigure.freemarker; +package org.springframework.boot.freemarker.autoconfigure; import org.junit.jupiter.api.Test; @@ -22,9 +22,9 @@ import org.springframework.aot.hint.RuntimeHints; import org.springframework.aot.hint.RuntimeHintsRegistrar; import org.springframework.aot.hint.TypeHint; import org.springframework.beans.factory.aot.AotServices; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider.FreeMarkerTemplateAvailabilityProperties; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider.FreeMarkerTemplateAvailabilityRuntimeHints; import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider.FreeMarkerTemplateAvailabilityProperties; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider.FreeMarkerTemplateAvailabilityRuntimeHints; import org.springframework.boot.testsupport.classpath.resources.WithResource; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.ResourceLoader; diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-freemarker/build.gradle b/spring-boot-project/spring-boot-starters/spring-boot-starter-freemarker/build.gradle index cc07a85cfe6..ede70f9480f 100644 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-freemarker/build.gradle +++ b/spring-boot-project/spring-boot-starters/spring-boot-starter-freemarker/build.gradle @@ -22,6 +22,5 @@ description = "Starter for building MVC web applications using FreeMarker views" dependencies { api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter")) - api("org.freemarker:freemarker") - api("org.springframework:spring-context-support") + api(project(":spring-boot-project:spring-boot-freemarker")) } diff --git a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle index 94ac9b24202..9e5d566f596 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-test-autoconfigure/build.gradle @@ -111,6 +111,7 @@ dependencies { testImplementation(project(":spring-boot-project:spring-boot-actuator")) testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure")) + testImplementation(project(":spring-boot-project:spring-boot-freemarker")) testImplementation(project(":spring-boot-project:spring-boot-testcontainers")) testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support")) testImplementation("ch.qos.logback:logback-classic") diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports index a9234fb44af..311994e3d14 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports @@ -1,9 +1,9 @@ # AutoConfigureWebFlux auto-configuration imports org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration -org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration +optional:org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration -org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration \ No newline at end of file +org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports index db5431f52bb..cc076aa6975 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports @@ -1,7 +1,7 @@ # AutoConfigureWebMvc auto-configuration imports org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration -org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration +optional:org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration @@ -11,4 +11,4 @@ optional:org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAu optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration -org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration \ No newline at end of file +org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java index e79765bf4c8..a6106b5335f 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java @@ -20,12 +20,12 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest; import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration; import org.springframework.context.ApplicationContext; diff --git a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java index 09296427bb5..5a5b7423357 100644 --- a/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java +++ b/spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java @@ -19,13 +19,13 @@ package org.springframework.boot.test.autoconfigure.web.servlet; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.client.OAuth2ClientAutoConfiguration; import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration; import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration; import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration; +import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration; import org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration; import org.springframework.context.ApplicationContext; import org.springframework.core.task.AsyncTaskExecutor;