diff --git a/spring-web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java b/spring-web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java index 5de3b4352b..635a2c76c2 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/AnnotationConfigWebApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -36,12 +36,13 @@ import org.springframework.web.context.ContextLoader; /** * {@link org.springframework.web.context.WebApplicationContext WebApplicationContext} * implementation which accepts component classes as input — in particular - * {@link org.springframework.context.annotation.Configuration @Configuration}-annotated + * {@link org.springframework.context.annotation.Configuration @Configuration} * classes, but also plain {@link org.springframework.stereotype.Component @Component} - * classes and JSR-330 compliant classes using {@code javax.inject} annotations. + * classes as well as JSR-330 compliant classes using {@code javax.inject} annotations. * *
Allows for registering classes one by one (specifying class names as config - * location) as well as for classpath scanning (specifying base packages as config location). + * locations) as well as via classpath scanning (specifying base packages as config + * locations). * *
This is essentially the equivalent of * {@link org.springframework.context.annotation.AnnotationConfigApplicationContext diff --git a/spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java b/spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java index c8a39cb290..eb28a675e7 100644 --- a/spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java +++ b/spring-web/src/main/java/org/springframework/web/context/support/GenericWebApplicationContext.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2022 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. @@ -39,23 +39,24 @@ import org.springframework.web.context.ServletContextAware; /** * Subclass of {@link GenericApplicationContext}, suitable for web environments. * - *
Implements {@link org.springframework.web.context.ConfigurableWebApplicationContext}, - * but is not intended for declarative setup in {@code web.xml}. Instead, it is designed - * for programmatic setup, for example for building nested contexts or for use within + *
Implements {@link ConfigurableWebApplicationContext}, but is not intended for + * declarative setup in {@code web.xml}. Instead, it is designed for programmatic setup, + * for example for building nested contexts or for use within * {@link org.springframework.web.WebApplicationInitializer WebApplicationInitializers}. * - *
If you intend to implement a WebApplicationContext that reads bean definitions - * from configuration files, consider deriving from AbstractRefreshableWebApplicationContext, - * reading the bean definitions in an implementation of the {@code loadBeanDefinitions} - * method. - * *
Interprets resource paths as servlet context resources, i.e. as paths beneath - * the web application root. Absolute paths, e.g. for files outside the web app root, - * can be accessed via "file:" URLs, as implemented by AbstractApplicationContext. + * the web application root. Absolute paths — for example, for files outside + * the web app root — can be accessed via {@code file:} URLs, as implemented + * by {@code AbstractApplicationContext}. * *
In addition to the special beans detected by - * {@link org.springframework.context.support.AbstractApplicationContext}, - * this class detects a ThemeSource bean in the context, with the name "themeSource". + * {@link org.springframework.context.support.AbstractApplicationContext AbstractApplicationContext}, + * this class detects a {@link ThemeSource} bean in the context, with the name "themeSource". + * + *
If you intend to implement a {@code WebApplicationContext} that reads bean definitions + * from configuration files, consider deriving from {@link AbstractRefreshableWebApplicationContext}, + * reading the bean definitions in an implementation of the {@code loadBeanDefinitions} + * method. * * @author Juergen Hoeller * @author Chris Beams @@ -72,7 +73,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext /** - * Create a new GenericWebApplicationContext. + * Create a new {@code GenericWebApplicationContext}. * @see #setServletContext * @see #registerBeanDefinition * @see #refresh @@ -82,8 +83,8 @@ public class GenericWebApplicationContext extends GenericApplicationContext } /** - * Create a new GenericWebApplicationContext for the given ServletContext. - * @param servletContext the ServletContext to run in + * Create a new {@code GenericWebApplicationContext} for the given {@link ServletContext}. + * @param servletContext the {@code ServletContext} to run in * @see #registerBeanDefinition * @see #refresh */ @@ -92,8 +93,8 @@ public class GenericWebApplicationContext extends GenericApplicationContext } /** - * Create a new GenericWebApplicationContext with the given DefaultListableBeanFactory. - * @param beanFactory the DefaultListableBeanFactory instance to use for this context + * Create a new {@code GenericWebApplicationContext} with the given {@link DefaultListableBeanFactory}. + * @param beanFactory the {@code DefaultListableBeanFactory} instance to use for this context * @see #setServletContext * @see #registerBeanDefinition * @see #refresh @@ -103,9 +104,10 @@ public class GenericWebApplicationContext extends GenericApplicationContext } /** - * Create a new GenericWebApplicationContext with the given DefaultListableBeanFactory. - * @param beanFactory the DefaultListableBeanFactory instance to use for this context - * @param servletContext the ServletContext to run in + * Create a new {@code GenericWebApplicationContext} with the given {@link DefaultListableBeanFactory} + * and {@link ServletContext}. + * @param beanFactory the {@code DefaultListableBeanFactory} instance to use for this context + * @param servletContext the {@code ServletContext} to run in * @see #registerBeanDefinition * @see #refresh */ @@ -116,7 +118,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext /** - * Set the ServletContext that this WebApplicationContext runs in. + * Set the {@link ServletContext} that this {@code WebApplicationContext} runs in. */ @Override public void setServletContext(@Nullable ServletContext servletContext) { @@ -143,8 +145,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext } /** - * Register ServletContextAwareProcessor. - * @see ServletContextAwareProcessor + * Register request/session scopes, environment beans, a {@link ServletContextAwareProcessor}, etc. */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { @@ -157,7 +158,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext } /** - * This implementation supports file paths beneath the root of the ServletContext. + * This implementation supports file paths beneath the root of the {@link ServletContext}. * @see ServletContextResource */ @Override @@ -236,7 +237,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext if (StringUtils.hasText(configLocation)) { throw new UnsupportedOperationException( "GenericWebApplicationContext does not support setConfigLocation(). " + - "Do you still have an 'contextConfigLocations' init-param set?"); + "Do you still have a 'contextConfigLocation' init-param set?"); } } @@ -245,7 +246,7 @@ public class GenericWebApplicationContext extends GenericApplicationContext if (!ObjectUtils.isEmpty(configLocations)) { throw new UnsupportedOperationException( "GenericWebApplicationContext does not support setConfigLocations(). " + - "Do you still have an 'contextConfigLocations' init-param set?"); + "Do you still have a 'contextConfigLocations' init-param set?"); } }