@@ -130,28 +130,27 @@ private void initContentNegotiatingViewResolver(View[] defaultViews) {
130130 }
131131
132132 /**
133- * Enable view resolution by forwarding to JSP pages with a default view name
134- * prefix of "/WEB-INF/" and a default suffix of ".jsp".
133+ * Register JSP view resolver using a default view name prefix of "/WEB-INF/"
134+ * and a default suffix of ".jsp".
135135 *
136- * <p>This method may be invoked multiple and each call will register a
137- * separate ViewResolver instance. Note that since it's not easy to determine
136+ * <p>When this method is invoked more than once, each call will register a
137+ * new ViewResolver instance. Note that since it's not easy to determine
138138 * if a JSP exists without forwarding to it, using multiple JSP-based view
139139 * resolvers only makes sense in combination with the "viewNames" property
140- * that indicates which view names are handled by which resolver.
140+ * on the resolver indicating which view names are handled by which resolver.
141141 */
142142 public UrlBasedViewResolverRegistration jsp () {
143143 return jsp ("/WEB-INF/" , ".jsp" );
144144 }
145145
146146 /**
147- * Enable view resolution by forwarding to JSP pages with the specified
148- * prefix and suffix.
147+ * Register JSP view resolver with the specified prefix and suffix.
149148 *
150- * <p>This method may be invoked multiple and each call will register a
151- * separate ViewResolver instance. Note that since it's not easy to determine
149+ * <p>When this method is invoked more than once, each call will register a
150+ * new ViewResolver instance. Note that since it's not easy to determine
152151 * if a JSP exists without forwarding to it, using multiple JSP-based view
153152 * resolvers only makes sense in combination with the "viewNames" property
154- * that indicates which view names are handled by which resolver.
153+ * on the resolver indicating which view names are handled by which resolver.
155154 */
156155 public UrlBasedViewResolverRegistration jsp (String prefix , String suffix ) {
157156 InternalResourceViewResolver resolver = new InternalResourceViewResolver ();
@@ -162,67 +161,63 @@ public UrlBasedViewResolverRegistration jsp(String prefix, String suffix) {
162161 }
163162
164163 /**
165- * Enable Tiles-based view resolution .
164+ * Register Tiles 3.x view resolver .
166165 *
167- * <p>By default tiles definitions are expected to be in "/WEB-INF/tiles.xml".
168- * To change that and other Tiles-related options please also implement the
169- * interface {@link TilesWebMvcConfigurer}.
166+ * <p><strong>Note</strong> that you must also configure Tiles by adding a
167+ * {@link org.springframework.web.servlet.view.tiles3.TilesConfigurer} bean.
170168 */
171169 public UrlBasedViewResolverRegistration tiles () {
172170 if (this .applicationContext != null && !hasBeanOfType (TilesConfigurer .class )) {
173- throw new BeanInitializationException (
174- "It looks like you're trying to configure Tiles view resolution. " +
175- "If not using @EnableWebMvc you must import WebMvcTilesConfiguration, " +
176- "or declare your own TilesConfigurer bean." );
171+ throw new BeanInitializationException ("In addition to a Tiles view resolver " +
172+ "there must also be a single TilesConfigurer bean in this web application context " +
173+ "(or its parent)." );
177174 }
178175 TilesRegistration registration = new TilesRegistration ();
179176 this .viewResolvers .add (registration .getViewResolver ());
180177 return registration ;
181178 }
182179
183180 /**
184- * Enable FreeMarker-based view resolution with an empty default view name
181+ * Register a FreeMarker view resolver with an empty default view name
185182 * prefix and a default suffix of ".ftl".
186183 *
187- * <p>By default the FreeMarker template loader path is set to "/WEB-INF/".
188- * To change that and other FreeMarker-related options please also implement
189- * the interface {@link FreeMarkerWebMvcConfigurer}.
184+ * <p><strong>Note</strong> that you must also configure FreeMarker by adding a
185+ * {@link org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer} bean.
190186 */
191187 public UrlBasedViewResolverRegistration freeMarker () {
192188 if (this .applicationContext != null && !hasBeanOfType (FreeMarkerConfigurer .class )) {
193- throw new BeanInitializationException (
194- "It looks like you're trying to configure FreeMarker view resolution. " +
195- "If not using @EnableWebMvc you must import WebMvcFreeMarkerConfiguration, " +
196- "or declare your own FreeMarkerConfigurer bean ." );
189+ throw new BeanInitializationException ("In addition to a FreeMarker view resolver " +
190+ "there must also be a single FreeMarkerConfig bean in this web application context " +
191+ "(or its parent): FreeMarkerConfigurer is the usual implementation. " +
192+ "This bean may be given any name ." );
197193 }
198194 FreeMarkerRegistration registration = new FreeMarkerRegistration ();
199195 this .viewResolvers .add (registration .getViewResolver ());
200196 return registration ;
201197 }
202198
203199 /**
204- * Enable Velocity-based view resolution with an empty default view name
200+ * Register Velocity view resolver with an empty default view name
205201 * prefix, a default suffix of ".vm".
206202 *
207- * <p>By default the Velocity resource loader path is set to "/WEB-INF/".
208- * To change that and other Velocity-related options please also implement
209- * the interface {@link VelocityWebMvcConfigurer}.
203+ * <p><strong>Note</strong> that you must also configure Velocity by adding a
204+ * {@link org.springframework.web.servlet.view.velocity.VelocityConfigurer} bean.
210205 */
211206 public UrlBasedViewResolverRegistration velocity () {
212207 if (this .applicationContext != null && !hasBeanOfType (VelocityConfigurer .class )) {
213- throw new BeanInitializationException (
214- "It looks like you're trying to configure Velocity view resolution. " +
215- "If not using @EnableWebMvc you must import WebMvcVelocityConfiguration, " +
216- "or declare your own VelocityConfigurer bean ." );
208+ throw new BeanInitializationException ("In addition to a Velocity view resolver " +
209+ "there must also be a single VelocityConfig bean in this web application context " +
210+ "(or its parent): VelocityConfigurer is the usual implementation. " +
211+ "This bean may be given any name ." );
217212 }
218213 VelocityRegistration registration = new VelocityRegistration ();
219214 this .viewResolvers .add (registration .getViewResolver ());
220215 return registration ;
221216 }
222217
223218 /**
224- * Enable the ability to map view names returned from controllers to
225- * {@link org.springframework.web.servlet.View} beans.
219+ * Register a bean name view resolver that interprets view names as the names
220+ * of {@link org.springframework.web.servlet.View} beans.
226221 */
227222 public void beanName () {
228223 BeanNameViewResolver resolver = new BeanNameViewResolver ();
0 commit comments