クラス GroovyWebApplicationContext
- 実装されているすべてのインターフェース:
groovy.lang.GroovyObject、CloseableSE、AutoCloseableSE、Aware、BeanFactory、BeanNameAware、HierarchicalBeanFactory、InitializingBean、ListableBeanFactory、ApplicationContext、ApplicationEventPublisher、ConfigurableApplicationContext、Lifecycle、MessageSource、EnvironmentCapable、ResourceLoader、ResourcePatternResolver、ThemeSource、ConfigurableWebApplicationContext、WebApplicationContext
GroovyBeanDefinitionReader によって理解されるように、Groovy Bean 定義スクリプトおよび / または XML ファイルから構成を取得する WebApplicationContext 実装。これは、基本的に Web 環境の GenericGroovyApplicationContext と同等です。デフォルトでは、構成はルートコンテキストの場合は "/WEB-INF/applicationContext.groovy" から取得され、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.groovy" から取得されます(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。
構成場所のデフォルトは、ContextLoader の "contextConfigLocation" コンテキストパラメーターと FrameworkServlet のサーブレット init-param によって上書きできます。構成場所は、"/WEB-INF/context.groovy" のような具体的なファイル、または "/WEB-INF/*-context.groovy" のような Ant スタイルのパターンのいずれかを示すことができます (パターンの詳細については、PathMatcher javadoc を参照してください)。".xml" ファイルは XML コンテンツとして解析され、その他の種類のリソースはすべて Groovy スクリプトとして解析されることに注意してください。
メモ: 複数の構成場所がある場合、後の Bean 定義は、以前にロードされたファイルで定義されたものをオーバーライドします。これを利用して、追加の Groovy スクリプトを介して特定の Bean 定義を意図的に上書きできます。
異なる Bean 定義形式を読み込む WebApplicationContext の場合は、AbstractRefreshableWebApplicationContext の類似のサブクラスを作成します。このようなコンテキスト実装は、ContextLoader の場合は "contextClass" context-param、FrameworkServlet の場合は "contextClass" init-param として指定できます。
- 導入:
- 4.1
- 作成者:
- Juergen Hoeller
- 関連事項:
ネストされたクラスの要約
クラス org.springframework.core.io.DefaultResourceLoader から継承されたネストクラス / インターフェース
DefaultResourceLoader.ClassPathContextResourceフィールドのサマリー
フィールド修飾子と型フィールド説明static final StringSEルートコンテキストのデフォルトの設定場所。static final StringSE名前空間の設定場所を構築するためのデフォルトのプレフィックス。static final StringSE名前空間の設定場所を構築するためのデフォルトのサフィックス。クラス org.springframework.context.support.AbstractApplicationContext から継承されたフィールド
APPLICATION_EVENT_MULTICASTER_BEAN_NAME, LIFECYCLE_PROCESSOR_BEAN_NAME, logger, MESSAGE_SOURCE_BEAN_NAMEインターフェース org.springframework.beans.factory.BeanFactory から継承されたフィールド
FACTORY_BEAN_PREFIXインターフェース org.springframework.context.ConfigurableApplicationContext から継承されたフィールド
APPLICATION_STARTUP_BEAN_NAME, CONFIG_LOCATION_DELIMITERS, CONVERSION_SERVICE_BEAN_NAME, ENVIRONMENT_BEAN_NAME, LOAD_TIME_WEAVER_BEAN_NAME, SHUTDOWN_HOOK_THREAD_NAME, SYSTEM_ENVIRONMENT_BEAN_NAME, SYSTEM_PROPERTIES_BEAN_NAMEインターフェース org.springframework.web.context.ConfigurableWebApplicationContext から継承されたフィールド
APPLICATION_CONTEXT_ID_PREFIX, SERVLET_CONFIG_BEAN_NAMEインターフェース org.springframework.core.io.ResourceLoader から継承されたフィールド
CLASSPATH_URL_PREFIXインターフェース org.springframework.core.io.support.ResourcePatternResolver から継承されたフィールド
CLASSPATH_ALL_URL_PREFIXインターフェース org.springframework.web.context.WebApplicationContext から継承されたフィールド
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAMEコンストラクターの概要
コンストラクターメソッドのサマリー
修飾子と型メソッド説明protected StringSE[]ルートコンテキストのデフォルトの場所は "/WEB-INF/applicationContext.groovy" であり、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.groovy" です(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。groovy.lang.MetaClassgetProperty(StringSE property) protected voidinitBeanDefinitionReader(GroovyBeanDefinitionReader beanDefinitionReader) このコンテキストの Bean 定義をロードするために使用される Bean 定義リーダーを初期化します。invokeMethod(StringSE name, ObjectSE args) protected void指定された GroovyBeanDefinitionReader で Bean 定義をロードします。protected voidloadBeanDefinitions(DefaultListableBeanFactory beanFactory) GroovyBeanDefinitionReader を介して Bean 定義をロードします。voidsetMetaClass(groovy.lang.MetaClass metaClass) voidsetProperty(StringSE property, ObjectSE newValue) クラス org.springframework.web.context.support.AbstractRefreshableWebApplicationContext から継承されたメソッド
createEnvironment, getApplicationName, getConfigLocations, getNamespace, getResourceByPath, getResourcePatternResolver, getServletConfig, getServletContext, getTheme, initPropertySources, onRefresh, postProcessBeanFactory, setNamespace, setServletConfig, setServletContextクラス org.springframework.context.support.AbstractRefreshableConfigApplicationContext から継承されたメソッド
afterPropertiesSet, resolvePath, setBeanName, setConfigLocation, setConfigLocations, setIdクラス org.springframework.context.support.AbstractRefreshableApplicationContext から継承されたメソッド
assertBeanFactoryActive, cancelRefresh, closeBeanFactory, createBeanFactory, customizeBeanFactory, getBeanFactory, hasBeanFactory, refreshBeanFactory, setAllowBeanDefinitionOverriding, setAllowCircularReferencesクラス org.springframework.context.support.AbstractApplicationContext から継承されたメソッド
addApplicationListener, addBeanFactoryPostProcessor, close, containsBean, containsBeanDefinition, containsLocalBean, destroyBeans, doClose, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, finishBeanFactoryInitialization, finishRefresh, getAliases, getApplicationListeners, getApplicationStartup, getAutowireCapableBeanFactory, getBean, getBean, getBean, getBean, getBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanFactoryPostProcessors, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotation, getDisplayName, getEnvironment, getId, getInternalParentBeanFactory, getInternalParentMessageSource, getMessage, getMessage, getMessage, getParent, getParentBeanFactory, getResources, getStartupDate, getType, getType, initApplicationEventMulticaster, initLifecycleProcessor, initMessageSource, invokeBeanFactoryPostProcessors, isActive, isPrototype, isRunning, isSingleton, isTypeMatch, isTypeMatch, obtainFreshBeanFactory, onClose, prepareBeanFactory, prepareRefresh, publishEvent, publishEvent, publishEvent, refresh, registerBeanPostProcessors, registerListeners, registerShutdownHook, removeApplicationListener, resetCommonCaches, setApplicationStartup, setDisplayName, setEnvironment, setParent, start, stop, toStringクラス org.springframework.core.io.DefaultResourceLoader から継承されたメソッド
addProtocolResolver, clearResourceCaches, getClassLoader, getProtocolResolvers, getResource, getResourceCache, setClassLoaderクラス java.lang.ObjectSE から継承されたメソッド
clone, equalsSE, finalize, getClass, hashCode, notify, notifyAll, wait, waitSE, waitSEインターフェース org.springframework.context.ApplicationContext から継承されたメソッド
getAutowireCapableBeanFactory, getDisplayName, getId, getParent, getStartupDateインターフェース org.springframework.context.ApplicationEventPublisher から継承されたメソッド
publishEvent, publishEventインターフェース org.springframework.beans.factory.BeanFactory から継承されたメソッド
containsBean, getAliases, getBean, getBean, getBean, getBean, getBean, getBeanProvider, getBeanProvider, getType, getType, isPrototype, isSingleton, isTypeMatch, isTypeMatchインターフェース org.springframework.context.ConfigurableApplicationContext から継承されたメソッド
addApplicationListener, addBeanFactoryPostProcessor, addProtocolResolver, close, getApplicationStartup, getBeanFactory, getEnvironment, isActive, refresh, registerShutdownHook, removeApplicationListener, setApplicationStartup, setClassLoader, setEnvironment, setId, setParentインターフェース org.springframework.web.context.ConfigurableWebApplicationContext から継承されたメソッド
setConfigLocation, setConfigLocationsインターフェース org.springframework.beans.factory.HierarchicalBeanFactory から継承されたメソッド
containsLocalBean, getParentBeanFactoryインターフェース org.springframework.beans.factory.ListableBeanFactory から継承されたメソッド
containsBeanDefinition, findAllAnnotationsOnBean, findAnnotationOnBean, findAnnotationOnBean, getBeanDefinitionCount, getBeanDefinitionNames, getBeanNamesForAnnotation, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanNamesForType, getBeanProvider, getBeanProvider, getBeansOfType, getBeansOfType, getBeansWithAnnotationインターフェース org.springframework.context.MessageSource から継承されたメソッド
getMessage, getMessage, getMessageインターフェース org.springframework.core.io.ResourceLoader から継承されたメソッド
getClassLoader, getResourceインターフェース org.springframework.core.io.support.ResourcePatternResolver から継承されたメソッド
getResources
フィールドの詳細
コンストラクターの詳細
GroovyWebApplicationContext
public GroovyWebApplicationContext()
メソッドの詳細
loadBeanDefinitions
protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) throws BeansException, IOExceptionSE GroovyBeanDefinitionReader を介して Bean 定義をロードします。- 次で指定:
- クラス
AbstractRefreshableApplicationContextのloadBeanDefinitions - パラメーター:
beanFactory- Bean 定義をロードする Bean ファクトリ- 例外:
BeansException- Bean 定義の解析が失敗した場合IOExceptionSE- Bean 定義ファイルのロードが失敗した場合- 関連事項:
initBeanDefinitionReader
このコンテキストの Bean 定義をロードするために使用される Bean 定義リーダーを初期化します。デフォルトの実装は空です。サブクラスでオーバーライドできます。
- パラメーター:
beanDefinitionReader- このコンテキストで使用される Bean 定義リーダー
loadBeanDefinitions
指定された GroovyBeanDefinitionReader で Bean 定義をロードします。Bean ファクトリのライフサイクルは refreshBeanFactory メソッドによって処理されるため、このメソッドは Bean 定義をロードおよび / または登録することだけを目的としています。
ロケーションパターンをリソースインスタンスに解決するための ResourcePatternResolver へのデリゲート。
- 例外:
IOExceptionSE- 必要な Groovy スクリプトまたは XML ファイルが見つからない場合- 関連事項:
getDefaultConfigLocations
ルートコンテキストのデフォルトの場所は "/WEB-INF/applicationContext.groovy" であり、名前空間が "test-servlet" のコンテキストの場合は "/WEB-INF/test-servlet.groovy" です(サーブレット名が "test" の DispatcherServlet インスタンスの場合など)。- オーバーライド:
- クラス
AbstractRefreshableConfigApplicationContextのgetDefaultConfigLocations - 戻り値:
- デフォルトの設定場所の配列(ある場合)
- 関連事項:
setMetaClass
public void setMetaClass(groovy.lang.MetaClass metaClass) - 次で指定:
- インターフェース
groovy.lang.GroovyObjectのsetMetaClass
getMetaClass
public groovy.lang.MetaClass getMetaClass()- 次で指定:
- インターフェース
groovy.lang.GroovyObjectのgetMetaClass
invokeMethod
- 次で指定:
- インターフェース
groovy.lang.GroovyObjectのinvokeMethod
setProperty
- 次で指定:
- インターフェース
groovy.lang.GroovyObjectのsetProperty
getProperty
- 次で指定:
- インターフェース
groovy.lang.GroovyObjectのgetProperty