Skip to content

Commit 0b2503f

Browse files
committed
Remove confusingly named templating enabled properties
Closes gh-32250
1 parent 8820a99 commit 0b2503f

File tree

17 files changed

+32
-96
lines changed

17 files changed

+32
-96
lines changed

module/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,6 @@ public class FreeMarkerProperties {
5050

5151
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
5252

53-
/**
54-
* Whether to enable MVC view resolution for this technology.
55-
*/
56-
private boolean enabled = true;
57-
5853
/**
5954
* Whether to enable template caching.
6055
*/
@@ -143,14 +138,6 @@ public class FreeMarkerProperties {
143138
*/
144139
private boolean preferFileSystemAccess;
145140

146-
public void setEnabled(boolean enabled) {
147-
this.enabled = enabled;
148-
}
149-
150-
public boolean isEnabled() {
151-
return this.enabled;
152-
}
153-
154141
public void setCheckTemplateLocation(boolean checkTemplateLocation) {
155142
this.checkTemplateLocation = checkTemplateLocation;
156143
}

module/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerReactiveWebConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import org.springframework.beans.factory.ObjectProvider;
2020
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
21-
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
2221
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2322
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2423
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
@@ -61,7 +60,6 @@ freemarker.template.Configuration freeMarkerConfiguration(FreeMarkerConfig confi
6160

6261
@Bean
6362
@ConditionalOnMissingBean(name = "freeMarkerViewResolver")
64-
@ConditionalOnBooleanProperty(name = "spring.freemarker.enabled", matchIfMissing = true)
6563
FreeMarkerViewResolver freeMarkerViewResolver() {
6664
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
6765
resolver.setPrefix(getProperties().getPrefix());

module/spring-boot-freemarker/src/main/java/org/springframework/boot/freemarker/autoconfigure/FreeMarkerServletWebConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import org.springframework.beans.factory.ObjectProvider;
2323
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
24-
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
2524
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
2625
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2726
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingFilterBean;
@@ -68,7 +67,6 @@ freemarker.template.Configuration freeMarkerConfiguration(FreeMarkerConfig confi
6867

6968
@Bean
7069
@ConditionalOnMissingBean(name = "freeMarkerViewResolver")
71-
@ConditionalOnBooleanProperty(name = "spring.freemarker.enabled", matchIfMissing = true)
7270
FreeMarkerViewResolver freeMarkerViewResolver() {
7371
FreeMarkerViewResolver resolver = new FreeMarkerViewResolver();
7472
getProperties().applyToMvcViewResolver(resolver);

module/spring-boot-freemarker/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717
"name": "spring.freemarker.content-type",
1818
"description": "Content-Type value. Only supported with Spring MVC."
1919
},
20+
{
21+
"name": "spring.freemarker.enabled",
22+
"deprecation": {
23+
"level": "error",
24+
"reason": "No longer required. To use FreeMarker without auto-configuration, depend directly on FreeMarker instead of spring-boot-freemarker.",
25+
"since": "4.0.0"
26+
}
27+
},
2028
{
2129
"name": "spring.freemarker.expose-request-attributes",
2230
"description": "Whether all request attributes should be added to the model prior to merging with the template. Only supported with Spring MVC."

module/spring-boot-groovy-templates/src/main/java/org/springframework/boot/groovy/template/autoconfigure/GroovyTemplateAutoConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626

2727
import org.springframework.beans.factory.ObjectProvider;
2828
import org.springframework.boot.autoconfigure.AutoConfiguration;
29-
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
3029
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
3130
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
3231
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
@@ -137,7 +136,6 @@ GroovyMarkupConfigurer groovyMarkupConfigurer(ObjectProvider<MarkupTemplateEngin
137136
@Configuration(proxyBeanMethods = false)
138137
@ConditionalOnClass({ Servlet.class, LocaleContextHolder.class, UrlBasedViewResolver.class })
139138
@ConditionalOnWebApplication(type = Type.SERVLET)
140-
@ConditionalOnBooleanProperty(name = "spring.groovy.template.enabled", matchIfMissing = true)
141139
static class GroovyWebConfiguration {
142140

143141
@Bean

module/spring-boot-groovy-templates/src/main/java/org/springframework/boot/groovy/template/autoconfigure/GroovyTemplateProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,6 @@ public class GroovyTemplateProperties {
5454

5555
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
5656

57-
/**
58-
* Whether to enable MVC view resolution for this technology.
59-
*/
60-
private boolean enabled = true;
61-
6257
/**
6358
* Whether to enable template caching.
6459
*/
@@ -185,14 +180,6 @@ public class GroovyTemplateProperties {
185180
*/
186181
private boolean useDoubleQuotes;
187182

188-
public boolean isEnabled() {
189-
return this.enabled;
190-
}
191-
192-
public void setEnabled(boolean enabled) {
193-
this.enabled = enabled;
194-
}
195-
196183
public boolean isCheckTemplateLocation() {
197184
return this.checkTemplateLocation;
198185
}

module/spring-boot-groovy-templates/src/main/resources/META-INF/additional-spring-configuration-metadata.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,14 @@
9696
"since": "3.5.0"
9797
}
9898
},
99+
{
100+
"name": "spring.groovy.template.enabled",
101+
"deprecation": {
102+
"level": "error",
103+
"reason": "No longer required. To use Groovy Templates without auto-configuration, depend directly on Groovy Templates instead of spring-boot-groovy-templates.",
104+
"since": "4.0.0"
105+
}
106+
},
99107
{
100108
"name": "spring.groovy.template.prefix",
101109
"defaultValue": ""

module/spring-boot-groovy-templates/src/test/java/org/springframework/boot/groovy/template/autoconfigure/GroovyTemplateAutoConfigurationTests.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import org.springframework.mock.web.MockHttpServletResponse;
4545
import org.springframework.mock.web.MockServletContext;
4646
import org.springframework.web.servlet.View;
47-
import org.springframework.web.servlet.ViewResolver;
4847
import org.springframework.web.servlet.support.RequestContext;
4948
import org.springframework.web.servlet.view.groovy.GroovyMarkupConfig;
5049
import org.springframework.web.servlet.view.groovy.GroovyMarkupConfigurer;
@@ -112,13 +111,6 @@ void includesViewResolution() throws Exception {
112111
assertThat(response.getContentType()).isEqualTo("text/html;charset=UTF-8");
113112
}
114113

115-
@Test
116-
void disableViewResolution() {
117-
TestPropertyValues.of("spring.groovy.template.enabled:false").applyTo(this.context);
118-
registerAndRefreshContext();
119-
assertThat(this.context.getBeanNamesForType(ViewResolver.class)).isEmpty();
120-
}
121-
122114
@Test
123115
@WithResource(name = "templates/includes.tpl", content = """
124116
yield 'include'

module/spring-boot-mustache/src/main/java/org/springframework/boot/mustache/autoconfigure/MustacheProperties.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ public class MustacheProperties {
6060
*/
6161
private @Nullable String requestContextAttribute;
6262

63-
/**
64-
* Whether to enable MVC view resolution for Mustache.
65-
*/
66-
private boolean enabled = true;
67-
6863
/**
6964
* Template encoding.
7065
*/
@@ -145,14 +140,6 @@ public void setCheckTemplateLocation(boolean checkTemplateLocation) {
145140
this.checkTemplateLocation = checkTemplateLocation;
146141
}
147142

148-
public boolean isEnabled() {
149-
return this.enabled;
150-
}
151-
152-
public void setEnabled(boolean enabled) {
153-
this.enabled = enabled;
154-
}
155-
156143
public static class Servlet {
157144

158145
/**

module/spring-boot-mustache/src/main/java/org/springframework/boot/mustache/autoconfigure/MustacheReactiveWebConfiguration.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

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

21-
import org.springframework.boot.autoconfigure.condition.ConditionalOnBooleanProperty;
2221
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
2322
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
2423
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
@@ -34,7 +33,6 @@ class MustacheReactiveWebConfiguration {
3433

3534
@Bean
3635
@ConditionalOnMissingBean
37-
@ConditionalOnBooleanProperty(name = "spring.mustache.enabled", matchIfMissing = true)
3836
MustacheViewResolver mustacheViewResolver(Compiler mustacheCompiler, MustacheProperties mustache) {
3937
MustacheViewResolver resolver = new MustacheViewResolver(mustacheCompiler);
4038
PropertyMapper map = PropertyMapper.get();

0 commit comments

Comments
 (0)