From ba0dd60de91808d9cfcf4aa1bede2d8c426c842f Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Wed, 5 Nov 2014 16:57:05 -0800 Subject: [PATCH] Rename charSet to charset Rename AbstractTemplateViewResolverProperties.setCharSet/getCharSet to setCharset/getCharset, deprecating the old method. Fixes gh-1835 --- .../FreeMarkerAutoConfiguration.java | 2 +- ...bstractTemplateViewResolverProperties.java | 24 +++++++++++++++---- .../appendix-application-properties.adoc | 6 ++--- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java index 35f793b50d9..b33545f1e50 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/freemarker/FreeMarkerAutoConfiguration.java @@ -91,7 +91,7 @@ public class FreeMarkerAutoConfiguration { protected void applyProperties(FreeMarkerConfigurationFactory factory) { factory.setTemplateLoaderPaths(this.properties.getTemplateLoaderPath()); - factory.setDefaultEncoding(this.properties.getCharSet()); + factory.setDefaultEncoding(this.properties.getCharset()); Properties settings = new Properties(); settings.putAll(this.properties.getSettings()); factory.setFreemarkerSettings(settings); diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java index 95f35acd17c..7426051d81b 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/template/AbstractTemplateViewResolverProperties.java @@ -38,7 +38,7 @@ public abstract class AbstractTemplateViewResolverProperties { private String contentType = "text/html"; - private String charSet = "UTF-8"; + private String charset = "UTF-8"; private String[] viewNames; @@ -87,19 +87,35 @@ public abstract class AbstractTemplateViewResolverProperties { public String getContentType() { return this.contentType + (this.contentType.contains(";charset=") ? "" : ";charset=" - + this.charSet); + + this.charset); } public void setContentType(String contentType) { this.contentType = contentType; } + /** + * @deprecated since 1.2.0 in favor of {@link #getCharset()} + */ + @Deprecated public String getCharSet() { - return this.charSet; + return getCharset(); } + /** + * @deprecated since 1.2.0 in favor of {@link #setCharset(String)} + */ + @Deprecated public void setCharSet(String charSet) { - this.charSet = charSet; + setCharset(charSet); + } + + public String getCharset() { + return this.charset; + } + + public void setCharset(String charset) { + this.charset = charset; } public String getPrefix() { diff --git a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 0ce11795db7..e9b62e1b333 100644 --- a/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -115,7 +115,7 @@ content into your application; rather pick only the properties that you need. spring.freemarker.allow-request-override=false spring.freemarker.cache=true spring.freemarker.check-template-location=true - spring.freemarker.char-set=UTF-8 + spring.freemarker.charset=UTF-8 spring.freemarker.contentType=text/html spring.freemarker.exposeRequestAttributes=false spring.freemarker.exposeSessionAttributes=false @@ -129,7 +129,7 @@ content into your application; rather pick only the properties that you need. # GROOVY TEMPLATES ({sc-spring-boot-autoconfigure}/groovy/template/GroovyTemplateAutoConfiguration.{sc-ext}[GroovyTemplateAutoConfiguration]) spring.groovy.template.cache=true - spring.groovy.template.char-set=UTF-8 + spring.groovy.template.charset=UTF-8 spring.groovy.template.configuration.*= # See Groovy's TemplateConfiguration spring.groovy.template.contentType=text/html spring.groovy.template.prefix=classpath:/templates/ @@ -140,7 +140,7 @@ content into your application; rather pick only the properties that you need. spring.velocity.allow-request-override=false spring.velocity.cache=true spring.velocity.check-template-location=true - spring.velocity.char-set=UTF-8 + spring.velocity.charset=UTF-8 spring.velocity.content-type=text/html spring.velocity.date-tool-attribute= spring.velocity.expose-Request-attributes=false