es.mcu.yingo.context
Class ContextLocation

java.lang.Object
  extended by org.springframework.core.io.DefaultResourceLoader
      extended by org.springframework.context.support.AbstractApplicationContext
          extended by org.springframework.context.support.AbstractRefreshableApplicationContext
              extended by org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
                  extended by org.springframework.web.context.support.XmlWebApplicationContext
                      extended by es.mcu.yingo.context.ContextLocation
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactory, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.HierarchicalBeanFactory, org.springframework.beans.factory.ListableBeanFactory, org.springframework.context.ApplicationContext, org.springframework.context.ApplicationEventPublisher, org.springframework.context.ConfigurableApplicationContext, 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 ContextLocation
extends org.springframework.web.context.support.XmlWebApplicationContext

Se extiende de la clase XmlWebApplicationContext para personalizar desde donde se lee el contexto de Spring desde la parte web.
Carga el contexto desde un ClassPathResource lo que permite que el archivo de configuración o los import de este estén dentro de un jar.
Añade también un BeanProcesadorIdAplicacion como un post procesador de la configuración de spring para poder añadir el id de aplicación de manera aútomática a todos los beans que implementen IdAplicacionAware Ejemplo de configuración en el xml:

  
   contextClass
   es.mcu.yingo.context.ContextLocation
  
  
   xmlConfiguracion
   /es/mcu/springConfig/spring-config.xml
  
 

Author:
miguel.esteban
See Also:
BeanProcesadorIdAplicacion, IdAplicacionAware

Field Summary
protected  org.apache.commons.logging.Log logger
           
 
Fields inherited from class org.springframework.web.context.support.XmlWebApplicationContext
DEFAULT_CONFIG_LOCATION, DEFAULT_CONFIG_LOCATION_PREFIX, DEFAULT_CONFIG_LOCATION_SUFFIX
 
Fields inherited from class org.springframework.context.support.AbstractApplicationContext
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, MESSAGE_SOURCE_BEAN_NAME
 
Fields inherited from interface org.springframework.web.context.ConfigurableWebApplicationContext
CONFIG_LOCATION_DELIMITERS
 
Fields inherited from interface org.springframework.web.context.WebApplicationContext
ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
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, CLASSPATH_URL_PREFIX
 
Fields inherited from interface org.springframework.beans.factory.BeanFactory
FACTORY_BEAN_PREFIX
 
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, CLASSPATH_URL_PREFIX
 
Constructor Summary
ContextLocation()
           
 
Method Summary
protected  void loadBeanDefinitions(org.springframework.beans.factory.xml.XmlBeanDefinitionReader miXmlBeanDefinitionReader)
          Para la parte web se carga el mismo contexto de Spring que el de la que se utiliza en la clase SpringContext
protected  void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory conListableBeanFactory)
           
 
Methods inherited from class org.springframework.web.context.support.XmlWebApplicationContext
getDefaultConfigLocations, initBeanDefinitionReader, loadBeanDefinitions
 
Methods inherited from class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext
getConfigLocations, getNamespace, getResourceByPath, getResourcePatternResolver, getServletContext, getTheme, onRefresh, refresh, resolvePath, setConfigLocations, setNamespace, setServletContext, toString
 
Methods inherited from class org.springframework.context.support.AbstractRefreshableApplicationContext
createBeanFactory, getBeanFactory, refreshBeanFactory
 
Methods inherited from class org.springframework.context.support.AbstractApplicationContext
addBeanFactoryPostProcessor, addListener, close, containsBean, containsBeanDefinition, containsLocalBean, destroy, getAliases, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType, getDisplayName, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, isSingleton, publishEvent, setDisplayName, setParent
 
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.ApplicationContext
getDisplayName, getParent, getStartupDate, publishEvent
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
 
Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResources
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getResource
 
Methods inherited from interface org.springframework.context.ConfigurableApplicationContext
addBeanFactoryPostProcessor, close, getBeanFactory, setParent
 
Methods inherited from interface org.springframework.context.ApplicationContext
getDisplayName, getParent, getStartupDate, publishEvent
 
Methods inherited from interface org.springframework.beans.factory.ListableBeanFactory
containsBeanDefinition, getBeanDefinitionCount, getBeanDefinitionNames, getBeanDefinitionNames, getBeanNamesForType, getBeanNamesForType, getBeansOfType, getBeansOfType
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.beans.factory.HierarchicalBeanFactory
containsLocalBean, getParentBeanFactory
 
Methods inherited from interface org.springframework.beans.factory.BeanFactory
containsBean, getAliases, getBean, getBean, getType, isSingleton
 
Methods inherited from interface org.springframework.context.MessageSource
getMessage, getMessage, getMessage
 
Methods inherited from interface org.springframework.core.io.support.ResourcePatternResolver
getResources
 
Methods inherited from interface org.springframework.core.io.ResourceLoader
getResource
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

ContextLocation

public ContextLocation()
Method Detail

loadBeanDefinitions

protected void loadBeanDefinitions(org.springframework.beans.factory.xml.XmlBeanDefinitionReader miXmlBeanDefinitionReader)
                            throws org.springframework.beans.BeansException,
                                   java.io.IOException
Para la parte web se carga el mismo contexto de Spring que el de la que se utiliza en la clase SpringContext

Overrides:
loadBeanDefinitions in class org.springframework.web.context.support.XmlWebApplicationContext
Throws:
org.springframework.beans.BeansException
java.io.IOException

postProcessBeanFactory

protected void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory conListableBeanFactory)
Overrides:
postProcessBeanFactory in class org.springframework.web.context.support.AbstractRefreshableWebApplicationContext