|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.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
public class JavaConfigWebApplicationContext
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
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. |
|
|
getBean(java.lang.Class<T> type)
Return an instance of the given type. |
|
|
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 |
|---|
public JavaConfigWebApplicationContext()
| Method Detail |
|---|
protected void prepareRefresh()
prepareRefresh in class org.springframework.context.support.AbstractApplicationContextprotected void invokeBeanFactoryPostProcessors(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory)
invokeBeanFactoryPostProcessors in class org.springframework.context.support.AbstractApplicationContextprotected void initConfigLocations()
protected void loadBeanDefinitions(org.springframework.beans.factory.support.DefaultListableBeanFactory beanFactory)
throws java.io.IOException,
org.springframework.beans.BeansException
@Configuration classes as bean
definitions within this context's BeanFactory for later processing by
ConfigurationPostProcessor
loadBeanDefinitions in class org.springframework.context.support.AbstractRefreshableApplicationContextjava.io.IOException
org.springframework.beans.BeansException#JavaConfigApplicationContext(Class...),
addConfigClass(Class)public <T> T getBean(java.lang.Class<T> type)
org.springframework.config.java.internal.factory.TypeSafeBeanFactoryPrimary
getBean in interface org.springframework.config.java.internal.factory.TypeSafeBeanFactorytype - desired instance type
Primary
public <T> T getBean(java.lang.Class<T> type,
java.lang.String beanName)
org.springframework.config.java.internal.factory.TypeSafeBeanFactoryPrimary
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.
getBean in interface org.springframework.config.java.internal.factory.TypeSafeBeanFactorypublic void addConfigClass(java.lang.Class<?> cls)
ConfigurableJavaConfigApplicationContext
addConfigClass in interface ConfigurableJavaConfigApplicationContextcls - a class annotated with Configurationpublic void addBasePackage(java.lang.String basePackage)
ConfigurableJavaConfigApplicationContextConfiguration 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.
addBasePackage in interface ConfigurableJavaConfigApplicationContextbasePackage - a package to scan (recursively) for any classes annotated with
Configuration
java.lang.UnsupportedOperationException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||