parent
5659d2c8a2
commit
855b6a6fac
|
@ -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"
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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")
|
||||
}
|
|
@ -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;
|
|
@ -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 })
|
|
@ -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;
|
|
@ -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 {
|
|
@ -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,
|
|
@ -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,
|
|
@ -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 {
|
||||
|
|
@ -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 {
|
|
@ -17,4 +17,4 @@
|
|||
/**
|
||||
* Auto-configuration for FreeMarker.
|
||||
*/
|
||||
package org.springframework.boot.autoconfigure.freemarker;
|
||||
package org.springframework.boot.freemarker.autoconfigure;
|
|
@ -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": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
# Template Availability Providers
|
||||
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
|
||||
org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider
|
|
@ -1,2 +1,2 @@
|
|||
org.springframework.aot.hint.RuntimeHintsRegistrar=\
|
||||
org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints
|
||||
org.springframework.boot.freemarker.autoconfigure.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints
|
|
@ -0,0 +1 @@
|
|||
org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration
|
|
@ -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;
|
|
@ -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;
|
|
@ -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"));
|
||||
}
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
|
@ -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"))
|
||||
}
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# 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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue