Create spring-boot-groovy-templates module

Closes gh-46089
This commit is contained in:
Phillip Webb 2025-03-19 21:08:10 -07:00 committed by Andy Wilkinson
parent 0f1c0d97d1
commit 5659d2c8a2
23 changed files with 174 additions and 132 deletions

View File

@ -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-groovy-templates"
include "spring-boot-project:spring-boot-jackson"
include "spring-boot-project:spring-boot-jdbc"
include "spring-boot-project:spring-boot-jetty"

View File

@ -114,7 +114,6 @@ dependencies {
optional("org.apache.tomcat.embed:tomcat-embed-websocket")
optional("org.apache.tomcat:tomcat-jdbc")
optional("org.apiguardian:apiguardian-api")
optional("org.apache.groovy:groovy-templates")
optional("org.eclipse.angus:angus-mail")
optional("com.github.ben-manes.caffeine:caffeine")
optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute")
@ -273,12 +272,6 @@ dependencies {
testRuntimeOnly("org.jetbrains.kotlin:kotlin-reflect")
}
tasks.named("checkSpringConfigurationMetadata").configure {
exclusions = [
"spring.groovy.template.configuration.*"
]
}
test {
jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED"
}

View File

@ -803,110 +803,6 @@
"name": "spring.graphql.schema.locations",
"defaultValue": "classpath:graphql/**/"
},
{
"name": "spring.groovy.template.configuration.auto-escape",
"deprecation": {
"replacement": "spring.groovy.template.auto-escape",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-indent",
"deprecation": {
"replacement": "spring.groovy.template.auto-indent",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-indent-string",
"deprecation": {
"replacement": "spring.groovy.template.auto-indent-string",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-new-line",
"deprecation": {
"replacement": "spring.groovy.template.auto-new-line",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.base-template-class",
"deprecation": {
"replacement": "spring.groovy.template.base-template-class",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.cache-templates",
"deprecation": {
"replacement": "spring.groovy.template.cache",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.declaration-encoding",
"deprecation": {
"replacement": "spring.groovy.template.declaration-encoding",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.expand-empty-elements",
"deprecation": {
"replacement": "spring.groovy.template.expand-empty-elements",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.locale",
"deprecation": {
"replacement": "spring.groovy.template.locale",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.new-line-string",
"deprecation": {
"replacement": "spring.groovy.template.new-line-string",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.resource-loader-path",
"deprecation": {
"replacement": "spring.groovy.template.resource-loader-path",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.use-double-quotes",
"deprecation": {
"replacement": "spring.groovy.template.use-double-quotes",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.prefix",
"defaultValue": ""
},
{
"name": "spring.groovy.template.suffix",
"defaultValue": ".tpl"
},
{
"name": "spring.http.converters.preferred-json-mapper",
"type": "java.lang.String",

View File

@ -19,7 +19,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.groovy.template.GroovyTemplateAvailabilityProvider,\
org.springframework.boot.autoconfigure.mustache.MustacheTemplateAvailabilityProvider,\
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\
org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider

View File

@ -1,3 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints,\
org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider$GroovyTemplateAvailabilityRuntimeHints
org.springframework.boot.autoconfigure.freemarker.FreeMarkerTemplateAvailabilityProvider$FreeMarkerTemplateAvailabilityRuntimeHints

View File

@ -48,7 +48,6 @@ org.springframework.boot.autoconfigure.graphql.rsocket.RSocketGraphQlClientAutoC
org.springframework.boot.autoconfigure.graphql.security.GraphQlWebFluxSecurityAutoConfiguration
org.springframework.boot.autoconfigure.graphql.security.GraphQlWebMvcSecurityAutoConfiguration
org.springframework.boot.autoconfigure.graphql.servlet.GraphQlWebMvcAutoConfiguration
org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration
org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration
org.springframework.boot.autoconfigure.h2.H2ConsoleAutoConfiguration
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration

View File

@ -1996,6 +1996,7 @@ bom {
"spring-boot-devtools",
"spring-boot-docker-compose",
"spring-boot-flyway",
"spring-boot-groovy-templates",
"spring-boot-jackson",
"spring-boot-jarmode-tools",
"spring-boot-jdbc",

View File

@ -0,0 +1,40 @@
/*
* 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 Groovy Templates"
dependencies {
api(project(":spring-boot-project:spring-boot"))
api("org.apache.groovy:groovy-templates")
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
optional("org.springframework:spring-webmvc")
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")
}

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;
import java.security.CodeSource;
import java.security.ProtectionDomain;
@ -32,7 +32,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.autoconfigure.template.TemplateLocation;
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.context.properties.bind.Bindable;
@ -57,9 +56,9 @@ import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver;
* @author Dave Syer
* @author Andy Wilkinson
* @author Brian Clozel
* @since 1.1.0
* @since 4.0.0
*/
@AutoConfiguration(after = WebMvcAutoConfiguration.class)
@AutoConfiguration
@ConditionalOnClass(MarkupTemplateEngine.class)
@EnableConfigurationProperties(GroovyTemplateProperties.class)
public class GroovyTemplateAutoConfiguration {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;
import java.util.ArrayList;
import java.util.Arrays;
@ -32,7 +32,7 @@ import org.springframework.util.ClassUtils;
* view templates.
*
* @author Dave Syer
* @since 1.1.0
* @since 4.0.0
*/
public class GroovyTemplateAvailabilityProvider extends PathBasedTemplateAvailabilityProvider {

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
@ -36,7 +36,7 @@ import org.springframework.web.servlet.view.AbstractTemplateViewResolver;
*
* @author Dave Syer
* @author Marten Deinum
* @since 1.1.0
* @since 4.0.0
*/
@ConfigurationProperties("spring.groovy.template")
public class GroovyTemplateProperties {

View File

@ -17,4 +17,4 @@
/**
* Auto-configuration for Groovy templates.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;

View File

@ -0,0 +1,108 @@
{
"properties": [
{
"name": "spring.groovy.template.configuration.auto-escape",
"deprecation": {
"replacement": "spring.groovy.template.auto-escape",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-indent",
"deprecation": {
"replacement": "spring.groovy.template.auto-indent",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-indent-string",
"deprecation": {
"replacement": "spring.groovy.template.auto-indent-string",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.auto-new-line",
"deprecation": {
"replacement": "spring.groovy.template.auto-new-line",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.base-template-class",
"deprecation": {
"replacement": "spring.groovy.template.base-template-class",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.cache-templates",
"deprecation": {
"replacement": "spring.groovy.template.cache",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.declaration-encoding",
"deprecation": {
"replacement": "spring.groovy.template.declaration-encoding",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.expand-empty-elements",
"deprecation": {
"replacement": "spring.groovy.template.expand-empty-elements",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.locale",
"deprecation": {
"replacement": "spring.groovy.template.locale",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.new-line-string",
"deprecation": {
"replacement": "spring.groovy.template.new-line-string",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.resource-loader-path",
"deprecation": {
"replacement": "spring.groovy.template.resource-loader-path",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.configuration.use-double-quotes",
"deprecation": {
"replacement": "spring.groovy.template.use-double-quotes",
"level": "warning",
"since": "3.5.0"
}
},
{
"name": "spring.groovy.template.prefix",
"defaultValue": ""
},
{
"name": "spring.groovy.template.suffix",
"defaultValue": ".tpl"
}
]
}

View File

@ -0,0 +1,3 @@
# Template Availability Providers
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAvailabilityProvider

View File

@ -0,0 +1,2 @@
org.springframework.aot.hint.RuntimeHintsRegistrar=\
org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAvailabilityProvider$GroovyTemplateAvailabilityRuntimeHints

View File

@ -0,0 +1 @@
org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;
import java.io.File;
import java.io.StringWriter;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.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.groovy.template.GroovyTemplateAvailabilityProvider.GroovyTemplateAvailabilityProperties;
import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAvailabilityProvider.GroovyTemplateAvailabilityRuntimeHints;
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
import org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAvailabilityProvider.GroovyTemplateAvailabilityProperties;
import org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAvailabilityProvider.GroovyTemplateAvailabilityRuntimeHints;
import org.springframework.boot.testsupport.classpath.resources.WithResource;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.ResourceLoader;

View File

@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.groovy.template;
package org.springframework.boot.groovy.template.autoconfigure;
import java.nio.charset.StandardCharsets;

View File

@ -21,6 +21,6 @@ plugins {
description = "Starter for building MVC web applications using Groovy Templates views"
dependencies {
api(project(":spring-boot-project:spring-boot-groovy-templates"))
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
api("org.apache.groovy:groovy-templates")
}

View File

@ -54,6 +54,7 @@ dependencies {
dockerTestRuntimeOnly("org.springframework.data:spring-data-redis")
optional(project(":spring-boot-project:spring-boot-flyway"))
optional(project(":spring-boot-project:spring-boot-groovy-templates"))
optional(project(":spring-boot-project:spring-boot-jackson"))
optional(project(":spring-boot-project:spring-boot-jdbc"))
optional(project(":spring-boot-project:spring-boot-jsonb"))

View File

@ -2,12 +2,12 @@
org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration
org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration
org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration
org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration
org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
optional:org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration
org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration

View File

@ -20,13 +20,13 @@ 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.groovy.template.GroovyTemplateAutoConfiguration;
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.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration;
import org.springframework.context.ApplicationContext;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;