Skip to content

Commit 7d72b35

Browse files
committed
Create spring-boot-mustache module
1 parent 7647980 commit 7d72b35

File tree

48 files changed

+176
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+176
-113
lines changed

settings.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ include "spring-boot-project:spring-boot-jsonb"
7373
include "spring-boot-project:spring-boot-kafka"
7474
include "spring-boot-project:spring-boot-liquibase"
7575
include "spring-boot-project:spring-boot-mail"
76+
include "spring-boot-project:spring-boot-mustache"
7677
include "spring-boot-project:spring-boot-parent"
7778
include "spring-boot-project:spring-boot-pulsar"
7879
include "spring-boot-project:spring-boot-r2dbc"

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

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ dependencies {
1818
optional("com.google.code.gson:gson")
1919
optional("com.oracle.database.jdbc:ucp11")
2020
optional("com.oracle.database.jdbc:ojdbc11")
21-
optional("com.samskivert:jmustache")
2221
optional("com.zaxxer:HikariCP")
2322
optional("io.netty:netty-tcnative-boringssl-static")
2423
optional("io.projectreactor:reactor-tools")

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ dependencies {
7575
optional("com.oracle.database.jdbc:ojdbc11")
7676
optional("com.oracle.database.jdbc:ucp11")
7777
optional("com.querydsl:querydsl-core")
78-
optional("com.samskivert:jmustache")
7978
optional("io.lettuce:lettuce-core")
8079
optional("io.projectreactor.netty:reactor-netty-http")
8180
optional("io.r2dbc:r2dbc-spi")
@@ -233,6 +232,7 @@ dependencies {
233232
testImplementation(project(":spring-boot-project:spring-boot-test"))
234233
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
235234
testImplementation(project(":spring-boot-project:spring-boot-undertow"))
235+
testImplementation(project(":spring-boot-project:spring-boot-mustache"))
236236
testImplementation(testFixtures(project(":spring-boot-project:spring-boot")))
237237
testImplementation(testFixtures(project(":spring-boot-project:spring-boot-autoconfigure")))
238238
testImplementation("ch.qos.logback:logback-classic")

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

-12
Original file line numberDiff line numberDiff line change
@@ -772,18 +772,6 @@
772772
"reason": "Narayana support has moved to third party starter."
773773
}
774774
},
775-
{
776-
"name": "spring.mustache.prefix",
777-
"defaultValue": "classpath:/templates/"
778-
},
779-
{
780-
"name": "spring.mustache.reactive.media-types",
781-
"defaultValue": "text/html;charset=UTF-8"
782-
},
783-
{
784-
"name": "spring.mustache.suffix",
785-
"defaultValue": ".mustache"
786-
},
787775
{
788776
"name": "spring.mvc.converters.preferred-json-mapper",
789777
"type": "java.lang.String",

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.mustache.MustacheTemplateAvailabilityProvider,\
1211
org.springframework.boot.autoconfigure.thymeleaf.ThymeleafTemplateAvailabilityProvider,\
1312
org.springframework.boot.autoconfigure.web.servlet.JspTemplateAvailabilityProvider
1413

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
@@ -51,7 +51,6 @@ org.springframework.boot.autoconfigure.ldap.embedded.EmbeddedLdapAutoConfigurati
5151
org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration
5252
org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration
5353
org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration
54-
org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration
5554
org.springframework.boot.autoconfigure.neo4j.Neo4jAutoConfiguration
5655
org.springframework.boot.autoconfigure.netty.NettyAutoConfiguration
5756
org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration

spring-boot-project/spring-boot-autoconfigure-all/src/test/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandlerIntegrationTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
import org.springframework.beans.factory.ObjectProvider;
3333
import org.springframework.boot.autoconfigure.AutoConfigurations;
3434
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
35-
import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration;
3635
import org.springframework.boot.autoconfigure.web.ServerProperties;
3736
import org.springframework.boot.autoconfigure.web.WebProperties;
3837
import org.springframework.boot.autoconfigure.web.reactive.HttpHandlerAutoConfiguration;
3938
import org.springframework.boot.autoconfigure.web.reactive.WebFluxAutoConfiguration;
39+
import org.springframework.boot.mustache.autoconfigure.MustacheAutoConfiguration;
4040
import org.springframework.boot.reactor.netty.autoconfigure.NettyReactiveWebServerAutoConfiguration;
4141
import org.springframework.boot.test.context.assertj.AssertableReactiveWebApplicationContext;
4242
import org.springframework.boot.test.context.runner.ReactiveWebApplicationContextRunner;

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

+1
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,7 @@ bom {
20542054
"spring-boot-loader-classic",
20552055
"spring-boot-loader-tools",
20562056
"spring-boot-mail",
2057+
"spring-boot-mustache",
20572058
"spring-boot-properties-migrator",
20582059
"spring-boot-pulsar",
20592060
"spring-boot-r2dbc",

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

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ dependencies {
7676
autoConfiguration(project(path: ":spring-boot-project:spring-boot-kafka", configuration: "autoConfigurationMetadata"))
7777
autoConfiguration(project(path: ":spring-boot-project:spring-boot-liquibase", configuration: "autoConfigurationMetadata"))
7878
autoConfiguration(project(path: ":spring-boot-project:spring-boot-mail", configuration: "autoConfigurationMetadata"))
79+
autoConfiguration(project(path: ":spring-boot-project:spring-boot-mustache", configuration: "autoConfigurationMetadata"))
7980
autoConfiguration(project(path: ":spring-boot-project:spring-boot-pulsar", configuration: "autoConfigurationMetadata"))
8081
autoConfiguration(project(path: ":spring-boot-project:spring-boot-r2dbc", configuration: "autoConfigurationMetadata"))
8182
autoConfiguration(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "autoConfigurationMetadata"))
@@ -114,6 +115,7 @@ dependencies {
114115
configurationProperties(project(path: ":spring-boot-project:spring-boot-kafka", configuration: "configurationPropertiesMetadata"))
115116
configurationProperties(project(path: ":spring-boot-project:spring-boot-liquibase", configuration: "configurationPropertiesMetadata"))
116117
configurationProperties(project(path: ":spring-boot-project:spring-boot-mail", configuration: "configurationPropertiesMetadata"))
118+
configurationProperties(project(path: ":spring-boot-project:spring-boot-mustache", configuration: "configurationPropertiesMetadata"))
117119
configurationProperties(project(path: ":spring-boot-project:spring-boot-pulsar", configuration: "configurationPropertiesMetadata"))
118120
configurationProperties(project(path: ":spring-boot-project:spring-boot-r2dbc", configuration: "configurationPropertiesMetadata"))
119121
configurationProperties(project(path: ":spring-boot-project:spring-boot-reactor-netty", configuration: "configurationPropertiesMetadata"))

spring-boot-project/spring-boot-docs/src/docs/antora/modules/how-to/pages/spring-mvc.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -232,11 +232,11 @@ javadoc:org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfigurati
232232
It looks for resources in a loader path by surrounding the view name with a prefix and suffix (externalized to `spring.groovy.template.prefix` and `spring.groovy.template.suffix`).
233233
The prefix and suffix have default values of '`classpath:/templates/`' and '`.tpl`', respectively.
234234
You can override javadoc:org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver[] by providing a bean of the same name.
235-
* If you use Mustache, you also have a javadoc:org.springframework.boot.web.servlet.view.MustacheViewResolver[] named '`mustacheViewResolver`'.
235+
* If you use Mustache, you also have a javadoc:org.springframework.boot.mustache.servlet.view.MustacheViewResolver[] named '`mustacheViewResolver`'.
236236
It looks for resources by surrounding the view name with a prefix and suffix.
237237
The prefix is `spring.mustache.prefix`, and the suffix is `spring.mustache.suffix`.
238238
The values of the prefix and suffix default to '`classpath:/templates/`' and '`.mustache`', respectively.
239-
You can override javadoc:org.springframework.boot.web.servlet.view.MustacheViewResolver[] by providing a bean of the same name.
239+
You can override javadoc:org.springframework.boot.mustache.servlet.view.MustacheViewResolver[] by providing a bean of the same name.
240240

241241
For more detail, see the following sections:
242242

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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 Mustache"
10+
11+
dependencies {
12+
api(project(":spring-boot-project:spring-boot"))
13+
api("com.samskivert:jmustache")
14+
api("org.springframework:spring-web")
15+
16+
optional("jakarta.servlet:jakarta.servlet-api")
17+
optional("org.springframework:spring-webmvc")
18+
optional("org.springframework:spring-webflux")
19+
optional(project(":spring-boot-project:spring-boot-autoconfigure"))
20+
21+
testImplementation(project(":spring-boot-project:spring-boot-test"))
22+
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
23+
testImplementation(project(":spring-boot-project:spring-boot-reactor-netty"))
24+
testImplementation(project(":spring-boot-project:spring-boot-tomcat"))
25+
testImplementation("io.projectreactor:reactor-test")
26+
27+
testRuntimeOnly("ch.qos.logback:logback-classic")
28+
}
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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

1919
import com.samskivert.mustache.Mustache;
2020
import com.samskivert.mustache.Mustache.TemplateLoader;
@@ -36,7 +36,7 @@
3636
*
3737
* @author Dave Syer
3838
* @author Brian Clozel
39-
* @since 1.2.2
39+
* @since 4.0.0
4040
*/
4141
@AutoConfiguration
4242
@ConditionalOnClass(Mustache.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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

1919
import java.nio.charset.Charset;
2020
import java.nio.charset.StandardCharsets;
@@ -31,7 +31,7 @@
3131
* {@link ConfigurationProperties @ConfigurationProperties} for Mustache.
3232
*
3333
* @author Dave Syer
34-
* @since 1.2.2
34+
* @since 4.0.0
3535
*/
3636
@ConfigurationProperties("spring.mustache")
3737
public class MustacheProperties {
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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

1919
import com.samskivert.mustache.Mustache.Compiler;
2020

@@ -23,7 +23,7 @@
2323
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
2525
import org.springframework.boot.context.properties.PropertyMapper;
26-
import org.springframework.boot.web.reactive.result.view.MustacheViewResolver;
26+
import org.springframework.boot.mustache.reactive.view.MustacheViewResolver;
2727
import org.springframework.context.annotation.Bean;
2828
import org.springframework.context.annotation.Configuration;
2929
import org.springframework.core.Ordered;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

1919
import java.io.InputStreamReader;
2020
import java.io.Reader;
@@ -35,7 +35,7 @@
3535
* partials (i.e. tiles-like features).
3636
*
3737
* @author Dave Syer
38-
* @since 1.2.2
38+
* @since 4.0.0
3939
* @see Mustache
4040
* @see Resource
4141
*/
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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

1919
import com.samskivert.mustache.Mustache.Compiler;
2020

@@ -23,7 +23,7 @@
2323
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2424
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
2525
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
26-
import org.springframework.boot.web.servlet.view.MustacheViewResolver;
26+
import org.springframework.boot.mustache.servlet.view.MustacheViewResolver;
2727
import org.springframework.context.annotation.Bean;
2828
import org.springframework.context.annotation.Configuration;
2929
import org.springframework.core.Ordered;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 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.mustache;
17+
package org.springframework.boot.mustache.autoconfigure;
1818

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

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 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 Mustache.
1919
*/
20-
package org.springframework.boot.autoconfigure.mustache;
20+
package org.springframework.boot.mustache.autoconfigure;
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2023 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.web.reactive.result.view;
17+
package org.springframework.boot.mustache.reactive.view;
1818

1919
import java.io.IOException;
2020
import java.io.InputStreamReader;
@@ -44,7 +44,7 @@
4444
* Spring WebFlux {@link View} using the Mustache template engine.
4545
*
4646
* @author Brian Clozel
47-
* @since 2.0.0
47+
* @since 4.0.0
4848
*/
4949
public class MustacheView extends AbstractUrlBasedView {
5050

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.web.reactive.result.view;
17+
package org.springframework.boot.mustache.reactive.view;
1818

1919
import com.samskivert.mustache.Mustache;
2020
import com.samskivert.mustache.Mustache.Compiler;
@@ -28,7 +28,7 @@
2828
*
2929
* @author Brian Clozel
3030
* @author Marten Deinum
31-
* @since 2.0.0
31+
* @since 4.0.0
3232
*/
3333
public class MustacheViewResolver extends UrlBasedViewResolver {
3434

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 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.
@@ -18,4 +18,4 @@
1818
* Additional {@link org.springframework.web.reactive.result.view.View Views} for use with
1919
* WebFlux.
2020
*/
21-
package org.springframework.boot.web.reactive.result.view;
21+
package org.springframework.boot.mustache.reactive.view;

spring-boot-project/spring-boot-all/src/main/java/org/springframework/boot/web/servlet/view/MustacheView.java renamed to spring-boot-project/spring-boot-mustache/src/main/java/org/springframework/boot/mustache/servlet/view/MustacheView.java

+3-3
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.web.servlet.view;
17+
package org.springframework.boot.mustache.servlet.view;
1818

1919
import java.io.IOException;
2020
import java.io.InputStreamReader;
@@ -37,7 +37,7 @@
3737
* @author Brian Clozel
3838
* @author Dave Syer
3939
* @author Phillip Webb
40-
* @since 2.0.0
40+
* @since 4.0.0
4141
*/
4242
public class MustacheView extends AbstractTemplateView {
4343

0 commit comments

Comments
 (0)