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.web.context.support.AbstractRefreshableWebApplicationContext
org.springframework.config.java.context.JavaConfigWebApplicationContext
- All Implemented Interfaces:
- BeanFactory, DisposableBean, HierarchicalBeanFactory, ListableBeanFactory, ApplicationContext, ApplicationEventPublisher, ConfigurableApplicationContext, Lifecycle, MessageSource, ResourceLoader, ResourcePatternResolver, ThemeSource, ConfigurableWebApplicationContext, WebApplicationContext
public class JavaConfigWebApplicationContext
- extends AbstractRefreshableWebApplicationContext
JavaConfig ApplicationContext implementation for use in the web tier. May be
supplied as the commandClass parameter to Spring MVC's
DispatcherServlet
- Author:
- Chris Beams
- See Also:
JavaConfigApplicationContext,
WebApplicationContext,
DispatcherServlet
| Methods inherited from class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext |
getConfigLocations, getDefaultConfigLocations, getNamespace, getResourceByPath, getResourcePatternResolver, getServletConfig, getServletContext, getTheme, onRefresh, postProcessBeanFactory, resolvePath, setConfigLocations, setNamespace, setServletConfig, setServletContext |
| 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, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, initApplicationEventMulticaster, initLifecycleDependentBeans, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, setDisplayName, setParent, start, stop, toString |
JavaConfigWebApplicationContext
public JavaConfigWebApplicationContext()
prepareRefresh
protected void prepareRefresh()
- Overrides:
prepareRefresh in class AbstractApplicationContext
initConfigLocations
protected void initConfigLocations()
loadBeanDefinitions
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory)
throws IOException
- Processes contents of configLocations, setting the values of
configClasses and basePackages appropriately.
- Specified by:
loadBeanDefinitions in class AbstractRefreshableApplicationContext
- Throws:
IllegalArgumentException - if the configLocations
array is null, contains any null elements, or contains names of any
classes that cannot be found
IOException
registerDefaultPostProcessors
protected void registerDefaultPostProcessors()
- Register the default post processors used for parsing Spring classes.
- See Also:
JavaConfigBeanFactoryPostProcessorRegistry
getBean
public <T> T getBean(Class<T> type)
- 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
- Parameters:
type - desired instance type
- Returns:
- instance matching type
- See Also:
Primary
getBean
public <T> T getBean(Class<T> type,
String beanName)
- 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.
Copyright © 2005-2008 Spring Framework. All Rights Reserved.