Deprecate rarely used bean definition variants
Closes gh-24875
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,8 +32,8 @@ import org.springframework.lang.Nullable;
|
||||
* @author Rod Johnson
|
||||
* @author Juergen Hoeller
|
||||
* @see org.springframework.web.servlet.view.InternalResourceViewResolver
|
||||
* @see org.springframework.web.servlet.view.ResourceBundleViewResolver
|
||||
* @see org.springframework.web.servlet.view.XmlViewResolver
|
||||
* @see org.springframework.web.servlet.view.ContentNegotiatingViewResolver
|
||||
* @see org.springframework.web.servlet.view.BeanNameViewResolver
|
||||
*/
|
||||
public interface ViewResolver {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,16 +29,8 @@ import org.springframework.web.servlet.ViewResolver;
|
||||
/**
|
||||
* A simple implementation of {@link org.springframework.web.servlet.ViewResolver}
|
||||
* that interprets a view name as a bean name in the current application context,
|
||||
* i.e. typically in the XML file of the executing {@code DispatcherServlet}.
|
||||
*
|
||||
* <p>This resolver can be handy for small applications, keeping all definitions
|
||||
* ranging from controllers to views in the same place. For larger applications,
|
||||
* {@link XmlViewResolver} will be the better choice, as it separates the XML
|
||||
* view bean definitions into a dedicated views file.
|
||||
*
|
||||
* <p>Note: Neither this {@code ViewResolver} nor {@link XmlViewResolver} supports
|
||||
* internationalization. Consider {@link ResourceBundleViewResolver} if you need
|
||||
* to apply different view resources per locale.
|
||||
* i.e. typically in the XML file of the executing {@code DispatcherServlet}
|
||||
* or in a corresponding configuration class.
|
||||
*
|
||||
* <p>Note: This {@code ViewResolver} implements the {@link Ordered} interface
|
||||
* in order to allow for flexible participation in {@code ViewResolver} chaining.
|
||||
@@ -48,8 +40,6 @@ import org.springframework.web.servlet.ViewResolver;
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @since 18.06.2003
|
||||
* @see XmlViewResolver
|
||||
* @see ResourceBundleViewResolver
|
||||
* @see UrlBasedViewResolver
|
||||
*/
|
||||
public class BeanNameViewResolver extends WebApplicationObjectSupport implements ViewResolver, Ordered {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,7 +29,6 @@ import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.support.PropertiesBeanDefinitionReader;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -59,7 +58,11 @@ import org.springframework.web.servlet.View;
|
||||
* @see java.util.ResourceBundle#getBundle
|
||||
* @see java.util.PropertyResourceBundle
|
||||
* @see UrlBasedViewResolver
|
||||
* @see BeanNameViewResolver
|
||||
* @deprecated as of 5.3, in favor of Spring's common view resolver variants
|
||||
* and/or custom resolver implementations
|
||||
*/
|
||||
@Deprecated
|
||||
public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
implements Ordered, InitializingBean, DisposableBean {
|
||||
|
||||
@@ -249,7 +252,8 @@ public class ResourceBundleViewResolver extends AbstractCachingViewResolver
|
||||
factory.setServletContext(getServletContext());
|
||||
|
||||
// Load bean definitions from resource bundle.
|
||||
PropertiesBeanDefinitionReader reader = new PropertiesBeanDefinitionReader(factory);
|
||||
org.springframework.beans.factory.support.PropertiesBeanDefinitionReader reader =
|
||||
new org.springframework.beans.factory.support.PropertiesBeanDefinitionReader(factory);
|
||||
reader.setDefaultParentBean(this.defaultParentView);
|
||||
for (ResourceBundle bundle : bundles) {
|
||||
reader.registerBeanDefinitions(bundle);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2020 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -52,9 +52,12 @@ import org.springframework.web.servlet.View;
|
||||
* @author Juergen Hoeller
|
||||
* @since 18.06.2003
|
||||
* @see org.springframework.context.ApplicationContext#getResource
|
||||
* @see ResourceBundleViewResolver
|
||||
* @see UrlBasedViewResolver
|
||||
* @see BeanNameViewResolver
|
||||
* @deprecated as of 5.3, in favor of Spring's common view resolver variants
|
||||
* and/or custom resolver implementations
|
||||
*/
|
||||
@Deprecated
|
||||
public class XmlViewResolver extends AbstractCachingViewResolver
|
||||
implements Ordered, InitializingBean, DisposableBean {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user