Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.config.java.context
Class JavaConfigWebApplicationContext

    java.lang.Object
      org.springframework.core.io.DefaultResourceLoader
          org.springframework.context.support.AbstractApplicationContext
              org.springframework.context.support.AbstractRefreshableApplicationContext
                  org.springframework.context.support.AbstractRefreshableConfigApplicationContext
                      org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
                          org.springframework.config.java.context.JavaConfigWebApplicationContext

All Implemented Interfaces:
  org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.ListableBeanFactory, ConfigurableJavaConfigApplicationContext, org.springframework.config.java.internal.factory.TypeSafeBeanFactory, org.springframework.context.ApplicationContext, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ConfigurableApplicationContext, org.springframework.context.Lifecycle, org.springframework.context.MessageSource, org.springframework.core.io.ResourceLoader, org.springframework.core.io.support.ResourcePatternResolver, org.springframework.ui.context.ThemeSource, org.springframework.web.context.ConfigurableWebApplicationContext, org.springframework.web.context.WebApplicationContext

    public class JavaConfigWebApplicationContext

extends org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
implements ConfigurableJavaConfigApplicationContext

JavaConfig ApplicationContext implementation for use in the web tier. May be supplied as the commandClass parameter to Spring MVC's DispatcherServlet

This class is almost wholly copy-and-pasted from `JavaConfigApplicationContext`. Because it the two classes must maintain mutually exclusive ancestry, achieving reuse is quite challenging. Consider a code-generation approach for JCWAC? See SJC-139

Author:
  Chris Beams
See Also:
  `JavaConfigApplicationContext`, `WebApplicationContext`, `org.springframework.web.servlet.DispatcherServlet`

Field Summary

Fields inherited from class org.springframework.context.support.AbstractApplicationContext
`APPLICATION_EVENT_MULTICASTER_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAME`

Fields inherited from interface org.springframework.context.ConfigurableApplicationContext
`CONFIG_LOCATION_DELIMITERS, LOAD_TIME_WEAVER_BEAN_NAME`

Fields inherited from interface org.springframework.beans.factory.BeanFactory
`FACTORY_BEAN_PREFIX`

Fields inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`CLASSPATH_ALL_URL_PREFIX`

Fields inherited from interface org.springframework.core.io.ResourceLoader
`CLASSPATH_URL_PREFIX`

Fields inherited from interface org.springframework.web.context.WebApplicationContext
`ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION`

Constructor Summary
`JavaConfigWebApplicationContext()`

Method Summary
`void` | `addBasePackage(java.lang.String basePackage)` Allows for incrementally building up the base packages to be scanned by this context.
`void` | `addConfigClass(java.lang.Class<?> cls)` Allows for incrementally building up the configuration classes to be processed by this context.
`
`<T> T`
` | `getBean(java.lang.Class<T> type)` Return an instance of the given type.
`
`<T> T`
` | `getBean(java.lang.Class<T> type, java.lang.String beanName)` Return an instance named beanName and of type type.
`protected void` | `initConfigLocations()`
`protected void` | `invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)`
`protected void` | `loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)` Loads any specified `@Configuration` classes as bean definitions within this context's BeanFactory for later processing by `ConfigurationPostProcessor`
`protected void` | `prepareRefresh()`

Methods inherited from class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
`getConfigLocations, getNamespace, getResourceByPath, getResourcePatternResolver, getServletConfig, getServletContext, getTheme, onRefresh, postProcessBeanFactory, setNamespace, setServletConfig, setServletContext`

Methods inherited from class org.springframework.context.support.AbstractRefreshableConfigApplicationContext
`afterPropertiesSet, getDefaultConfigLocations, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setId`

Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
`closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferences`

Methods inherited from class org.springframework.context.support.AbstractApplicationContext
`addApplicationListener, addBeanFactoryPostProcessor, addListener, cancelRefresh, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, destroyBeans, doClose, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, initApplicationEventMulticaster, initMessageSource, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setParent, start, stop, toString`

Methods inherited from class org.springframework.core.io.DefaultResourceLoader
`getClassLoader, getResource, setClassLoader`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
`addApplicationListener, addBeanFactoryPostProcessor, close, getBeanFactory, isActive, refresh, registerShutdownHook, setParent`

Methods inherited from interface org.springframework.context.ApplicationContext
`getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDate`

Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
`containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType`

Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
`containsLocalBean, getParentBeanFactory`

Methods inherited from interface org.springframework.beans.factory.BeanFactory
`containsBean, getAliases, getBean, getBean, getBean, getType, isPrototype, isSingleton, isTypeMatch`

Methods inherited from interface org.springframework.context.MessageSource
`getMessage, getMessage, getMessage`

Methods inherited from interface org.springframework.context.ApplicationEventPublisher
`publishEvent`

Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
`getResources`

Methods inherited from interface org.springframework.core.io.ResourceLoader
`getClassLoader, getResource`

Methods inherited from interface org.springframework.context.Lifecycle
`isRunning, start, stop`

Methods inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext
`setConfigLocation, setConfigLocations`

Constructor Detail

### JavaConfigWebApplicationContext

    public JavaConfigWebApplicationContext()

Method Detail

### prepareRefresh

    protected void prepareRefresh()

  Overrides:
    `prepareRefresh` in class `org.springframework.context.support.AbstractApplicationContext`

### invokeBeanFactoryPostProcessors

    protected void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)

  Overrides:
    `invokeBeanFactoryPostProcessors` in class `org.springframework.context.support.AbstractApplicationContext`

### initConfigLocations

    protected void initConfigLocations()

### loadBeanDefinitions

    protected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
                                throws java.io.IOException,
                                       org.springframework.beans.BeansException

  Loads any specified `@Configuration` classes as bean definitions within this context's BeanFactory for later processing by `ConfigurationPostProcessor`

  Specified by:
    `loadBeanDefinitions` in class `org.springframework.context.support.AbstractRefreshableApplicationContext`
  Throws:
    `java.io.IOException`
    `org.springframework.beans.BeansException`
  See Also:
    `#JavaConfigApplicationContext(Class...)`, `addConfigClass(Class)`

### getBean

    public <T> T getBean(java.lang.Class<T> type)

  Description copied from interface: `org.springframework.config.java.internal.factory.TypeSafeBeanFactory`
  Return an instance of the given type. If multiple instances of the same type exist, instances are inspected to see if exactly one is marked as `Primary`

  Specified by:
    `getBean` in interface `org.springframework.config.java.internal.factory.TypeSafeBeanFactory`
  Parameters:
    `type` - desired instance type
  Returns:
    instance matching type
  See Also:
    `Primary`

### getBean

    public <T> T getBean(java.lang.Class<T> type,
                         java.lang.String beanName)

  Description copied from interface: `org.springframework.config.java.internal.factory.TypeSafeBeanFactory`
  Return an instance named beanName and of type type. Useful in disambiguation cases where there is more than one bean of a given type within the factory and none is marked as `Primary`

  This method is similar to its predecessor `BeanFactory.getBean(String, Class)`, but this variant takes advantages of generics and removes the casting burden from the caller.

  Specified by:
    `getBean` in interface `org.springframework.config.java.internal.factory.TypeSafeBeanFactory`
  Returns:
    instance of type named beanName

### addConfigClass

    public void addConfigClass(java.lang.Class<?> cls)

  Description copied from interface: `ConfigurableJavaConfigApplicationContext`
  Allows for incrementally building up the configuration classes to be processed by this context. May only be called on a context still 'open for configuration' meaning that the user will need to manually call refresh() after all classes have been added.

  Specified by:
    `addConfigClass` in interface `ConfigurableJavaConfigApplicationContext`
  Parameters:
    `cls` - a class annotated with `Configuration`

### addBasePackage

    public void addBasePackage(java.lang.String basePackage)

  Description copied from interface: `ConfigurableJavaConfigApplicationContext`
  Allows for incrementally building up the base packages to be scanned by this context. Packages are presumed to have one or more `Configuration` class definitions within, but it is not considered an error if none are found. This method may only be called on a context still 'open for configuration' meaning that the user will need to manually call refresh() after all base packages have been added.

  Specified by:
    `addBasePackage` in interface `ConfigurableJavaConfigApplicationContext`
  Parameters:
    `basePackage` - a package to scan (recursively) for any classes annotated with `Configuration`
  Throws:
    `java.lang.UnsupportedOperationException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD