diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java index 18925330987..55c99e8045d 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactory.java @@ -69,7 +69,9 @@ import org.springframework.util.StringUtils; * @see VelocityEngineFactoryBean * @see org.springframework.web.servlet.view.velocity.VelocityConfigurer * @see org.apache.velocity.app.VelocityEngine + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityEngineFactory { protected final Log logger = LogFactory.getLog(getClass()); diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java index 7c45782625f..bb2baa16398 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineFactoryBean.java @@ -46,7 +46,9 @@ import org.springframework.context.ResourceLoaderAware; * @see #setVelocityProperties * @see #setResourceLoaderPath * @see org.springframework.web.servlet.view.velocity.VelocityConfigurer + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityEngineFactoryBean extends VelocityEngineFactory implements FactoryBean, InitializingBean, ResourceLoaderAware { diff --git a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java index bfc1e135a69..640221293d5 100644 --- a/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java +++ b/spring-context-support/src/main/java/org/springframework/ui/velocity/VelocityEngineUtils.java @@ -30,7 +30,9 @@ import org.apache.velocity.exception.VelocityException; * * @author Juergen Hoeller * @since 22.01.2004 + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public abstract class VelocityEngineUtils { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewResolversBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewResolversBeanDefinitionParser.java index 06e645f5814..cad1ad70fe4 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewResolversBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/ViewResolversBeanDefinitionParser.java @@ -39,7 +39,6 @@ import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; import org.springframework.web.servlet.view.script.ScriptTemplateViewResolver; import org.springframework.web.servlet.view.tiles3.TilesViewResolver; -import org.springframework.web.servlet.view.velocity.VelocityViewResolver; /** * Parse the {@code view-resolvers} MVC namespace element and register @@ -69,6 +68,7 @@ public class ViewResolversBeanDefinitionParser implements BeanDefinitionParser { public static final String VIEW_RESOLVER_BEAN_NAME = "mvcViewResolver"; + @SuppressWarnings("deprecation") public BeanDefinition parse(Element element, ParserContext context) { Object source = context.extractSource(element); context.pushContainingComponent(new CompositeComponentDefinition(element.getTagName(), source)); @@ -100,7 +100,7 @@ public class ViewResolversBeanDefinitionParser implements BeanDefinitionParser { addUrlBasedViewResolverProperties(resolverElement, resolverBeanDef); } else if ("velocity".equals(name)) { - resolverBeanDef = new RootBeanDefinition(VelocityViewResolver.class); + resolverBeanDef = new RootBeanDefinition(org.springframework.web.servlet.view.velocity.VelocityViewResolver.class); resolverBeanDef.getPropertyValues().add("suffix", ".vm"); addUrlBasedViewResolverProperties(resolverElement, resolverBeanDef); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewResolverRegistry.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewResolverRegistry.java index c4fedda88ae..bc21e6e0b55 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewResolverRegistry.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/ViewResolverRegistry.java @@ -41,8 +41,6 @@ import org.springframework.web.servlet.view.script.ScriptTemplateConfigurer; import org.springframework.web.servlet.view.script.ScriptTemplateViewResolver; import org.springframework.web.servlet.view.tiles3.TilesConfigurer; import org.springframework.web.servlet.view.tiles3.TilesViewResolver; -import org.springframework.web.servlet.view.velocity.VelocityConfigurer; -import org.springframework.web.servlet.view.velocity.VelocityViewResolver; /** * Assist with the configuration of a chain of @@ -86,10 +84,8 @@ public class ViewResolverRegistry { * Enable use of a {@link ContentNegotiatingViewResolver} to front all other * configured view resolvers and select among all selected Views based on * media types requested by the client (e.g. in the Accept header). - * *

If invoked multiple times the provided default views will be added to * any other default views that may have been configured already. - * * @see ContentNegotiatingViewResolver#setDefaultViews */ public void enableContentNegotiation(View... defaultViews) { @@ -100,7 +96,6 @@ public class ViewResolverRegistry { * Enable use of a {@link ContentNegotiatingViewResolver} to front all other * configured view resolvers and select among all selected Views based on * media types requested by the client (e.g. in the Accept header). - * *

If invoked multiple times the provided default views will be added to * any other default views that may have been configured already. * @@ -112,9 +107,8 @@ public class ViewResolverRegistry { } private void initContentNegotiatingViewResolver(View[] defaultViews) { - // ContentNegotiatingResolver in the registry: elevate its precedence! - this.order = (this.order == null ? Ordered.HIGHEST_PRECEDENCE : this.order); + this.order = (this.order != null ? this.order : Ordered.HIGHEST_PRECEDENCE); if (this.contentNegotiatingResolver != null) { if (!ObjectUtils.isEmpty(defaultViews)) { @@ -136,7 +130,6 @@ public class ViewResolverRegistry { /** * Register JSP view resolver using a default view name prefix of "/WEB-INF/" * and a default suffix of ".jsp". - * *

When this method is invoked more than once, each call will register a * new ViewResolver instance. Note that since it's not easy to determine * if a JSP exists without forwarding to it, using multiple JSP-based view @@ -149,7 +142,6 @@ public class ViewResolverRegistry { /** * Register JSP view resolver with the specified prefix and suffix. - * *

When this method is invoked more than once, each call will register a * new ViewResolver instance. Note that since it's not easy to determine * if a JSP exists without forwarding to it, using multiple JSP-based view @@ -166,7 +158,6 @@ public class ViewResolverRegistry { /** * Register Tiles 3.x view resolver. - * *

Note that you must also configure Tiles by adding a * {@link org.springframework.web.servlet.view.tiles3.TilesConfigurer} bean. */ @@ -184,7 +175,6 @@ public class ViewResolverRegistry { /** * Register a FreeMarker view resolver with an empty default view name * prefix and a default suffix of ".ftl". - * *

Note that you must also configure FreeMarker by adding a * {@link org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer} bean. */ @@ -203,12 +193,13 @@ public class ViewResolverRegistry { /** * Register Velocity view resolver with an empty default view name * prefix and a default suffix of ".vm". - * *

Note that you must also configure Velocity by adding a * {@link org.springframework.web.servlet.view.velocity.VelocityConfigurer} bean. + * @deprecated as of Spring 4.3, in favor of FreeMarker */ + @Deprecated public UrlBasedViewResolverRegistration velocity() { - if (this.applicationContext != null && !hasBeanOfType(VelocityConfigurer.class)) { + if (this.applicationContext != null && !hasBeanOfType(org.springframework.web.servlet.view.velocity.VelocityConfigurer.class)) { throw new BeanInitializationException("In addition to a Velocity view resolver " + "there must also be a single VelocityConfig bean in this web application context " + "(or its parent): VelocityConfigurer is the usual implementation. " + @@ -313,22 +304,23 @@ public class ViewResolverRegistry { private static class TilesRegistration extends UrlBasedViewResolverRegistration { - private TilesRegistration() { + public TilesRegistration() { super(new TilesViewResolver()); } } private static class VelocityRegistration extends UrlBasedViewResolverRegistration { - private VelocityRegistration() { - super(new VelocityViewResolver()); + @SuppressWarnings("deprecation") + public VelocityRegistration() { + super(new org.springframework.web.servlet.view.velocity.VelocityViewResolver()); getViewResolver().setSuffix(".vm"); } } private static class FreeMarkerRegistration extends UrlBasedViewResolverRegistration { - private FreeMarkerRegistration() { + public FreeMarkerRegistration() { super(new FreeMarkerViewResolver()); getViewResolver().setSuffix(".ftl"); } @@ -336,7 +328,7 @@ public class ViewResolverRegistry { private static class GroovyMarkupRegistration extends UrlBasedViewResolverRegistration { - private GroovyMarkupRegistration() { + public GroovyMarkupRegistration() { super(new GroovyMarkupViewResolver()); getViewResolver().setSuffix(".tpl"); } @@ -344,7 +336,7 @@ public class ViewResolverRegistry { private static class ScriptRegistration extends UrlBasedViewResolverRegistration { - private ScriptRegistration() { + public ScriptRegistration() { super(new ScriptTemplateViewResolver()); getViewResolver(); } diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java index 9bffdadf102..934883a3092 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfig.java @@ -26,7 +26,9 @@ import org.apache.velocity.app.VelocityEngine; * @author Rod Johnson * @see VelocityConfigurer * @see VelocityView + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public interface VelocityConfig { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java index 1dbd8a20fc6..5f10a43ad3c 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityConfigurer.java @@ -25,7 +25,6 @@ import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ResourceLoaderAware; -import org.springframework.ui.velocity.VelocityEngineFactory; import org.springframework.web.context.ServletContextAware; /** @@ -69,8 +68,10 @@ import org.springframework.web.context.ServletContextAware; * @see #setResourceLoaderPath * @see #setVelocityEngine * @see VelocityView + * @deprecated as of Spring 4.3, in favor of FreeMarker */ -public class VelocityConfigurer extends VelocityEngineFactory +@Deprecated +public class VelocityConfigurer extends org.springframework.ui.velocity.VelocityEngineFactory implements VelocityConfig, InitializingBean, ResourceLoaderAware, ServletContextAware { /** the name of the resource loader for Spring's bind macros */ diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java index 65493af17c8..b5e3ae8a55a 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutView.java @@ -50,7 +50,9 @@ import org.springframework.core.NestedIOException; * @see #setLayoutUrl * @see #setLayoutKey * @see #setScreenContentKey + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityLayoutView extends VelocityToolboxView { /** diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java index 02124e0da1d..630dcc3e37b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityLayoutViewResolver.java @@ -31,7 +31,9 @@ import org.springframework.web.servlet.view.AbstractUrlBasedView; * @see #setLayoutUrl * @see #setLayoutKey * @see #setScreenContentKey + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityLayoutViewResolver extends VelocityViewResolver { private String layoutUrl; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java index ad54ffdaf42..8513f9d511b 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityToolboxView.java @@ -62,7 +62,9 @@ import org.springframework.util.ReflectionUtils; * @see #initTool * @see org.apache.velocity.tools.view.context.ViewContext * @see org.apache.velocity.tools.view.context.ChainedContext + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityToolboxView extends VelocityView { private String toolboxConfigLocation; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java index 23751a5d24d..936ee0d89de 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityView.java @@ -83,7 +83,9 @@ import org.springframework.web.util.NestedServletException; * @see #setVelocityEngine * @see VelocityConfig * @see VelocityConfigurer + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityView extends AbstractTemplateView { private Map> toolAttributes; diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java index e812ec92d82..95191a4aaeb 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/velocity/VelocityViewResolver.java @@ -40,7 +40,9 @@ import org.springframework.web.servlet.view.AbstractUrlBasedView; * @see #setDateToolAttribute * @see #setNumberToolAttribute * @see VelocityView + * @deprecated as of Spring 4.3, in favor of FreeMarker */ +@Deprecated public class VelocityViewResolver extends AbstractTemplateViewResolver { private String dateToolAttribute; diff --git a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.3.xsd b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.3.xsd index 73b68e6c3b6..ed4a4ffb507 100644 --- a/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.3.xsd +++ b/spring-webmvc/src/main/resources/org/springframework/web/servlet/config/spring-mvc-4.3.xsd @@ -1022,16 +1022,6 @@ ]]> - - - element - or declare a VelocityConfigurer bean. - ]]> - - - - - - - - - - - - - - -