Skip to content

Commit 26198b0

Browse files
committed
Create spring-boot-thymeleaf module
1 parent c6926a8 commit 26198b0

File tree

26 files changed

+131
-82
lines changed

26 files changed

+131
-82
lines changed

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ include "spring-boot-project:spring-boot-test"
8787
include "spring-boot-project:spring-boot-test-autoconfigure"
8888
include "spring-boot-project:spring-boot-test-integration-tests"
8989
include "spring-boot-project:spring-boot-testcontainers"
90+
include "spring-boot-project:spring-boot-thymeleaf"
9091
include "spring-boot-project:spring-boot-tomcat"
9192
include "spring-boot-project:spring-boot-tools:spring-boot-antlib"
9293
include "spring-boot-project:spring-boot-tools:spring-boot-autoconfigure-processor"

spring-boot-project/spring-boot-autoconfigure-all/build.gradle

+1-5
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,10 @@ dependencies {
108108
optional("org.apiguardian:apiguardian-api")
109109
optional("org.eclipse.angus:angus-mail")
110110
optional("com.github.ben-manes.caffeine:caffeine")
111-
optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute")
112111
optional("com.sendgrid:sendgrid-java") {
113112
exclude group: "commons-logging", module: "commons-logging"
114113
}
115114
optional("com.zaxxer:HikariCP")
116-
optional("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
117115
optional("org.aspectj:aspectjweaver")
118116
optional("org.cache2k:cache2k-spring")
119117
optional("org.eclipse.jetty.ee10:jetty-ee10-webapp")
@@ -220,9 +218,6 @@ dependencies {
220218
exclude group: "org.eclipse.jetty", module: "jetty-servlet"
221219
exclude group: "jakarta.mail", module: "jakarta.mail-api"
222220
}
223-
optional("org.thymeleaf:thymeleaf")
224-
optional("org.thymeleaf:thymeleaf-spring6")
225-
optional("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")
226221
optional("redis.clients:jedis")
227222

228223
testImplementation(project(":spring-boot-project:spring-boot-freemarker"))
@@ -231,6 +226,7 @@ dependencies {
231226
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
232227
testImplementation(project(":spring-boot-project:spring-boot-undertow"))
233228
testImplementation(project(":spring-boot-project:spring-boot-mustache"))
229+
testImplementation(project(":spring-boot-project:spring-boot-thymeleaf"))
234230
testImplementation(testFixtures(project(":spring-boot-project:spring-boot")))
235231
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
236232
testImplementation("ch.qos.logback:logback-classic")

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/additional-spring-configuration-metadata.json

-27
Original file line numberDiff line numberDiff line change
@@ -1343,33 +1343,6 @@
13431343
"level": "warning"
13441344
}
13451345
},
1346-
{
1347-
"name": "spring.thymeleaf.prefix",
1348-
"defaultValue": "classpath:/templates/"
1349-
},
1350-
{
1351-
"name": "spring.thymeleaf.reactive.media-types",
1352-
"defaultValue": [
1353-
"text/html",
1354-
"application/xhtml+xml",
1355-
"application/xml",
1356-
"text/xml",
1357-
"application/rss+xml",
1358-
"application/atom+xml",
1359-
"application/javascript",
1360-
"application/ecmascript",
1361-
"text/javascript",
1362-
"text/ecmascript",
1363-
"application/json",
1364-
"text/css",
1365-
"text/plain",
1366-
"text/event-stream"
1367-
]
1368-
},
1369-
{
1370-
"name": "spring.thymeleaf.suffix",
1371-
"defaultValue": ".html"
1372-
},
13731346
{
13741347
"name": "spring.webflux.hiddenmethod.filter.enabled",
13751348
"type": "java.lang.Boolean",

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring.factories

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ org.springframework.boot.autoconfigure.data.redis.RedisUrlSyntaxFailureAnalyzer
88

99
# Template Availability Providers
1010
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
11-
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\
1211
org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider
1312

1413
# Depends on Database Initialization Detectors

spring-boot-project/spring-boot-autoconfigure-all/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2Auth
6565
org.springframework.boot.autoconfigure.security.oauth2.server.servlet.OAuth2AuthorizationServerJwtAutoConfiguration
6666
org.springframework.boot.autoconfigure.sendgrid.SendGridAutoConfiguration
6767
org.springframework.boot.autoconfigure.session.SessionAutoConfiguration
68-
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
6968
org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
7069
org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration
7170
org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/servlet/WelcomePageIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222

2323
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration;
25-
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
2625
import org.springframework.boot.builder.SpringApplicationBuilder;
2726
import org.springframework.boot.test.context.SpringBootTest;
2827
import org.springframework.boot.test.web.client.TestRestTemplate;
2928
import org.springframework.boot.test.web.server.LocalServerPort;
29+
import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration;
3030
import org.springframework.boot.tomcat.autoconfigure.servlet.TomcatServletWebServerAutoConfiguration;
3131
import org.springframework.context.annotation.Configuration;
3232
import org.springframework.context.annotation.Import;

spring-boot-project/spring-boot-dependencies/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -2122,6 +2122,7 @@ bom {
21222122
"spring-boot-test",
21232123
"spring-boot-test-autoconfigure",
21242124
"spring-boot-testcontainers",
2125+
"spring-boot-thymeleaf",
21252126
"spring-boot-tomcat",
21262127
"spring-boot-tx",
21272128
"spring-boot-undertow",

spring-boot-project/spring-boot-docs/build.gradle

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ dependencies {
8686
autoConfiguration(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "autoConfigurationMetadata"))
8787
autoConfiguration(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "autoConfigurationMetadata"))
8888
autoConfiguration(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "autoConfigurationMetadata"))
89+
autoConfiguration(project(path: ":spring-boot-project:spring-boot-thymeleaf", configuration: "autoConfigurationMetadata"))
8990
autoConfiguration(project(path: ":spring-boot-project:spring-boot-tomcat", configuration: "autoConfigurationMetadata"))
9091
autoConfiguration(project(path: ":spring-boot-project:spring-boot-tx", configuration: "autoConfigurationMetadata"))
9192
autoConfiguration(project(path: ":spring-boot-project:spring-boot-undertow", configuration: "autoConfigurationMetadata"))
@@ -130,6 +131,7 @@ dependencies {
130131
configurationProperties(project(path: ":spring-boot-project:spring-boot-rsocket", configuration: "configurationPropertiesMetadata"))
131132
configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata"))
132133
configurationProperties(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "configurationPropertiesMetadata"))
134+
configurationProperties(project(path: ":spring-boot-project:spring-boot-thymeleaf", configuration: "configurationPropertiesMetadata"))
133135
configurationProperties(project(path: ":spring-boot-project:spring-boot-tomcat", configuration: "configurationPropertiesMetadata"))
134136
configurationProperties(project(path: ":spring-boot-project:spring-boot-tx", configuration: "configurationPropertiesMetadata"))
135137
configurationProperties(project(path: ":spring-boot-project:spring-boot-undertow", configuration: "configurationPropertiesMetadata"))

spring-boot-project/spring-boot-starters/spring-boot-starter-thymeleaf/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ description = "Starter for building MVC web applications using Thymeleaf views"
66

77
dependencies {
88
api(project(":spring-boot-project:spring-boot-starters:spring-boot-starter"))
9-
api("org.thymeleaf:thymeleaf-spring6")
9+
api(project(":spring-boot-project:spring-boot-thymeleaf"))
1010
}

spring-boot-project/spring-boot-test-autoconfigure/build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ dependencies {
107107
testImplementation(project(":spring-boot-project:spring-boot-freemarker"))
108108
testImplementation(project(":spring-boot-project:spring-boot-mustache"))
109109
testImplementation(project(":spring-boot-project:spring-boot-testcontainers"))
110+
testImplementation(project(":spring-boot-project:spring-boot-thymeleaf"))
110111
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
111112
testImplementation("ch.qos.logback:logback-classic")
112113
testImplementation("com.fasterxml.jackson.module:jackson-module-parameter-names")

spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebFlux.imports

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration
33
optional:org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration
44
org.springframework.boot.autoconfigure.http.codec.CodecsAutoConfiguration
55
optional:org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration
6-
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
6+
optional:org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration
77
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
88
org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration
99
org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration

spring-boot-project/spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureWebMvc.imports

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ org.springframework.boot.autoconfigure.hateoas.HypermediaAutoConfiguration
66
org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration
77
optional:org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration
88
org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration
9-
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration
9+
optional:org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration
1010
optional:org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration
1111
optional:org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration
1212
org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/reactive/webclient/WebFluxTestAutoConfigurationIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
import org.springframework.boot.autoconfigure.context.MessageSourceAutoConfiguration;
2323
import org.springframework.boot.autoconfigure.security.oauth2.client.reactive.ReactiveOAuth2ClientAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.security.oauth2.resource.reactive.ReactiveOAuth2ResourceServerAutoConfiguration;
25-
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.web.reactive.error.ErrorWebFluxAutoConfiguration;
2726
import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration;
2827
import org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration;
2928
import org.springframework.boot.test.autoconfigure.web.reactive.WebFluxTest;
29+
import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration;
3030
import org.springframework.boot.validation.autoconfigure.ValidationAutoConfiguration;
3131
import org.springframework.context.ApplicationContext;
3232

spring-boot-project/spring-boot-test-autoconfigure/src/test/java/org/springframework/boot/test/autoconfigure/web/servlet/WebMvcTestAutoConfigurationIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@
2222
import org.springframework.boot.autoconfigure.security.oauth2.client.servlet.OAuth2ClientAutoConfiguration;
2323
import org.springframework.boot.autoconfigure.security.oauth2.resource.servlet.OAuth2ResourceServerAutoConfiguration;
2424
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
25-
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration;
2625
import org.springframework.boot.autoconfigure.web.servlet.HttpEncodingAutoConfiguration;
2726
import org.springframework.boot.freemarker.autoconfigure.FreeMarkerAutoConfiguration;
2827
import org.springframework.boot.groovy.template.autoconfigure.GroovyTemplateAutoConfiguration;
2928
import org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration;
29+
import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration;
3030
import org.springframework.context.ApplicationContext;
3131
import org.springframework.core.task.AsyncTaskExecutor;
3232
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
plugins {
2+
id "java-library"
3+
id "org.springframework.boot.auto-configuration"
4+
id "org.springframework.boot.configuration-properties"
5+
id "org.springframework.boot.deployed"
6+
id "org.springframework.boot.optional-dependencies"
7+
}
8+
9+
description = "Spring Boot Thymeleaf"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot"))
13+
api("org.thymeleaf:thymeleaf-spring6")
14+
api("org.springframework:spring-web")
15+
16+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
17+
optional("org.springframework.security:spring-security-web")
18+
optional("org.springframework:spring-webmvc")
19+
optional("org.springframework:spring-webflux")
20+
optional("org.thymeleaf:thymeleaf")
21+
optional("org.thymeleaf.extras:thymeleaf-extras-springsecurity6")
22+
optional("com.github.mxab.thymeleaf.extras:thymeleaf-extras-data-attribute")
23+
optional("nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect")
24+
optional("jakarta.servlet:jakarta.servlet-api")
25+
26+
testImplementation(project(":spring-boot-project:spring-boot-test"))
27+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
28+
29+
testRuntimeOnly("ch.qos.logback:logback-classic")
30+
}
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.thymeleaf;
17+
package org.springframework.boot.thymeleaf.autoconfigure;
1818

1919
import org.thymeleaf.ITemplateEngine;
2020
import org.thymeleaf.dialect.IDialect;
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.thymeleaf;
17+
package org.springframework.boot.thymeleaf.autoconfigure;
1818

1919
import java.util.LinkedHashMap;
2020

@@ -40,12 +40,10 @@
4040
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
4141
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
4242
import org.springframework.boot.autoconfigure.template.TemplateLocation;
43-
import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties.Reactive;
4443
import org.springframework.boot.autoconfigure.web.ConditionalOnEnabledResourceChain;
45-
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
46-
import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration;
4744
import org.springframework.boot.context.properties.EnableConfigurationProperties;
4845
import org.springframework.boot.context.properties.PropertyMapper;
46+
import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafProperties.Reactive;
4947
import org.springframework.boot.web.servlet.FilterRegistrationBean;
5048
import org.springframework.context.ApplicationContext;
5149
import org.springframework.context.annotation.Bean;
@@ -69,9 +67,10 @@
6967
* @author Daniel Fernández
7068
* @author Kazuki Shimizu
7169
* @author Artsiom Yudovin
72-
* @since 1.0.0
70+
* @since 4.0.0
7371
*/
74-
@AutoConfiguration(after = { WebMvcAutoConfiguration.class, WebFluxAutoConfiguration.class })
72+
@AutoConfiguration(afterName = { "org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration",
73+
"org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration" })
7574
@EnableConfigurationProperties(ThymeleafProperties.class)
7675
@ConditionalOnClass({ TemplateMode.class, SpringTemplateEngine.class })
7776
@Import({ TemplateEngineConfigurations.ReactiveTemplateEngineConfiguration.class,
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.thymeleaf;
17+
package org.springframework.boot.thymeleaf.autoconfigure;
1818

1919
import java.nio.charset.Charset;
2020
import java.nio.charset.StandardCharsets;
@@ -32,7 +32,7 @@
3232
* @author Brian Clozel
3333
* @author Daniel Fernández
3434
* @author Kazuki Shimizu
35-
* @since 1.2.0
35+
* @since 4.0.0
3636
*/
3737
@ConfigurationProperties("spring.thymeleaf")
3838
public class ThymeleafProperties {
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package org.springframework.boot.autoconfigure.thymeleaf;
17+
package org.springframework.boot.thymeleaf.autoconfigure;
1818

1919
import org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider;
2020
import org.springframework.core.env.Environment;
@@ -27,7 +27,7 @@
2727
*
2828
* @author Andy Wilkinson
2929
* @author Madhura Bhave
30-
* @since 1.1.0
30+
* @since 4.0.0
3131
*/
3232
public class ThymeleafTemplateAvailabilityProvider implements TemplateAvailabilityProvider {
3333

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -17,4 +17,4 @@
1717
/**
1818
* Auto-configuration for Thymeleaf.
1919
*/
20-
package org.springframework.boot.autoconfigure.thymeleaf;
20+
package org.springframework.boot.thymeleaf.autoconfigure;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"groups": [],
3+
"properties": [
4+
{
5+
"name": "spring.thymeleaf.prefix",
6+
"defaultValue": "classpath:/templates/"
7+
},
8+
{
9+
"name": "spring.thymeleaf.reactive.media-types",
10+
"defaultValue": [
11+
"text/html",
12+
"application/xhtml+xml",
13+
"application/xml",
14+
"text/xml",
15+
"application/rss+xml",
16+
"application/atom+xml",
17+
"application/javascript",
18+
"application/ecmascript",
19+
"text/javascript",
20+
"text/ecmascript",
21+
"application/json",
22+
"text/css",
23+
"text/plain",
24+
"text/event-stream"
25+
]
26+
},
27+
{
28+
"name": "spring.thymeleaf.suffix",
29+
"defaultValue": ".html"
30+
}
31+
],
32+
"hints": [],
33+
"ignored": {
34+
"properties": [
35+
]
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Template Availability Providers
2+
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
3+
org.springframework.boot.thymeleaf.autoconfigure.ThymeleafTemplateAvailabilityProvider
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
org.springframework.boot.thymeleaf.autoconfigure.ThymeleafAutoConfiguration

0 commit comments

Comments
 (0)