You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.java
+73-59
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2002-2023 the original author or authors.
2
+
* Copyright 2002-2024 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -41,9 +41,11 @@
41
41
importorg.springframework.util.CollectionUtils;
42
42
43
43
/**
44
-
* Factory that configures a FreeMarker Configuration. Can be used standalone, but
45
-
* typically you will either use FreeMarkerConfigurationFactoryBean for preparing a
46
-
* Configuration as bean reference, or FreeMarkerConfigurer for web views.
44
+
* Factory that configures a FreeMarker {@link Configuration}.
45
+
*
46
+
* <p>Can be used standalone, but typically you will either use
47
+
* {@link FreeMarkerConfigurationFactoryBean} for preparing a {@code Configuration}
48
+
* as a bean reference, or {@code FreeMarkerConfigurer} for web views.
47
49
*
48
50
* <p>The optional "configLocation" property sets the location of a FreeMarker
49
51
* properties file, within the current application. FreeMarker properties can be
@@ -52,17 +54,18 @@
52
54
* subject to constraints set by FreeMarker.
53
55
*
54
56
* <p>The "freemarkerVariables" property can be used to specify a Map of
55
-
* shared variables that will be applied to the Configuration via the
57
+
* shared variables that will be applied to the {@code Configuration} via the
56
58
* {@code setAllSharedVariables()} method. Like {@code setSettings()},
57
59
* these entries are subject to FreeMarker constraints.
58
60
*
59
61
* <p>The simplest way to use this class is to specify a "templateLoaderPath";
60
62
* FreeMarker does not need any further configuration then.
61
63
*
62
-
* <p>Note: Spring's FreeMarker support requires FreeMarker 2.3 or higher.
64
+
* <p>Note: Spring's FreeMarker support requires FreeMarker 2.3.21 or higher.
63
65
*
64
66
* @author Darren Davison
65
67
* @author Juergen Hoeller
68
+
* @author Sam Brannen
66
69
* @since 03.03.2004
67
70
* @see #setConfigLocation
68
71
* @see #setFreemarkerSettings
@@ -107,7 +110,7 @@ public class FreeMarkerConfigurationFactory {
107
110
108
111
/**
109
112
* Set the location of the FreeMarker config file.
110
-
* Alternatively, you can specify all setting locally.
113
+
* <p>Alternatively, you can specify all settings locally.
111
114
* @see #setFreemarkerSettings
112
115
* @see #setTemplateLoaderPath
113
116
*/
@@ -134,25 +137,33 @@ public void setFreemarkerVariables(Map<String, Object> variables) {
134
137
}
135
138
136
139
/**
137
-
* Set the default encoding for the FreeMarker configuration.
138
-
* If not specified, FreeMarker will use the platform file encoding.
139
-
* <p>Used for template rendering unless there is an explicit encoding specified
140
-
* for the rendering process (for example, on Spring's FreeMarkerView).
140
+
* Set the default encoding for the FreeMarker {@link Configuration}, which
141
+
* is used to decode byte sequences to character sequences when reading template
142
+
* files.
143
+
* <p>If not specified, FreeMarker will read template files using the platform
144
+
* file encoding (defined by the JVM system property {@code file.encoding})
145
+
* or {@code "utf-8"} if the platform file encoding is undefined.
146
+
* <p>Note that the encoding is not used for template rendering. Instead, an
147
+
* explicit encoding must be specified for the rendering process — for
148
+
* example, via Spring's {@code FreeMarkerView} or {@code FreeMarkerViewResolver}.
Copy file name to clipboardexpand all lines: spring-context-support/src/main/java/org/springframework/ui/freemarker/FreeMarkerConfigurationFactoryBean.java
+12-9
Original file line number
Diff line number
Diff line change
@@ -27,22 +27,25 @@
27
27
importorg.springframework.lang.Nullable;
28
28
29
29
/**
30
-
* Factory bean that creates a FreeMarker Configuration and provides it as
31
-
* bean reference. This bean is intended for any kind of usage of FreeMarker
32
-
* in application code, e.g. for generating email content. For web views,
33
-
* FreeMarkerConfigurer is used to set up a FreeMarkerConfigurationFactory.
34
-
* <p>
35
-
* The simplest way to use this class is to specify just a "templateLoaderPath";
30
+
* Factory bean that creates a FreeMarker {@link Configuration} and provides it
31
+
* as a bean reference.
32
+
*
33
+
* <p>This bean is intended for any kind of usage of FreeMarker in application
34
+
* code — for example, for generating email content. For web views,
35
+
* {@code FreeMarkerConfigurer} is used to set up a {@link FreeMarkerConfigurationFactory}.
36
+
*
37
+
* <p>The simplest way to use this class is to specify just a "templateLoaderPath";
36
38
* you do not need any further configuration then. For example, in a web
0 commit comments