public class MockApplicationContext
extends groovy.lang.GroovyObjectSupport
implements org.springframework.web.context.WebApplicationContext
| Modifier and Type | Class and Description |
|---|---|
class |
MockApplicationContext.MockResource |
CONTEXT_ATTRIBUTES_BEAN_NAME, CONTEXT_PARAMETERS_BEAN_NAME, ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, SCOPE_APPLICATION, SCOPE_GLOBAL_SESSION, SCOPE_REQUEST, SCOPE_SESSION, SERVLET_CONTEXT_BEAN_NAME| Constructor and Description |
|---|
MockApplicationContext() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
containsBean(java.lang.String name) |
boolean |
containsBeanDefinition(java.lang.String beanName) |
boolean |
containsLocalBean(java.lang.String arg0) |
<A extends java.lang.annotation.Annotation> |
findAnnotationOnBean(java.lang.String name,
java.lang.Class<A> annotation) |
java.lang.String[] |
getAliases(java.lang.String name) |
java.lang.String |
getApplicationName() |
org.springframework.beans.factory.config.AutowireCapableBeanFactory |
getAutowireCapableBeanFactory() |
<T> T |
getBean(java.lang.Class<T> tClass) |
java.lang.Object |
getBean(java.lang.String name) |
<T> T |
getBean(java.lang.String name,
java.lang.Class<T> requiredType) |
java.lang.Object |
getBean(java.lang.String name,
java.lang.Object... args) |
int |
getBeanDefinitionCount() |
java.lang.String[] |
getBeanDefinitionNames() |
java.lang.String[] |
getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Find all names of beans whose
Class has the supplied Annotation
type, without creating any bean instances yet. |
java.lang.String[] |
getBeanNamesForType(java.lang.Class type) |
java.lang.String[] |
getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans) |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type) |
<T> java.util.Map<java.lang.String,T> |
getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit) |
java.util.Map<java.lang.String,java.lang.Object> |
getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation) |
java.lang.ClassLoader |
getClassLoader() |
java.lang.String |
getDisplayName() |
org.springframework.core.env.Environment |
getEnvironment() |
java.lang.String |
getId() |
java.lang.String |
getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale) |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale) |
java.lang.String |
getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale) |
org.springframework.context.ApplicationContext |
getParent() |
org.springframework.beans.factory.BeanFactory |
getParentBeanFactory() |
java.lang.Object |
getProperty(java.lang.String name) |
org.springframework.core.io.Resource |
getResource(java.lang.String location) |
org.springframework.core.io.Resource[] |
getResources(java.lang.String locationPattern) |
javax.servlet.ServletContext |
getServletContext() |
long |
getStartupDate() |
java.lang.Class |
getType(java.lang.String name) |
boolean |
isPrototype(java.lang.String s) |
boolean |
isSingleton(java.lang.String name) |
boolean |
isTypeMatch(java.lang.String name,
java.lang.Class aClass) |
void |
publishEvent(org.springframework.context.ApplicationEvent event) |
void |
registerIgnoredClassPathLocation(java.lang.String location)
Registers a resource that should not be found on the classpath.
|
void |
registerMockBean(java.lang.String name,
java.lang.Object instance) |
void |
registerMockResource(java.lang.String location)
Registers a mock resource.
|
void |
registerMockResource(java.lang.String location,
java.lang.String contents)
Registers a mock resource.
|
void |
setServletContext(javax.servlet.ServletContext servletContext) |
void |
unregisterIgnoredClassPathLocation(java.lang.String location)
Unregisters a resource that should not be found on the classpath.
|
void |
unregisterMockResource(java.lang.String location)
Unregisters a mock resource.
|
public void registerMockBean(java.lang.String name,
java.lang.Object instance)
public void registerMockResource(java.lang.String location)
location - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.propertiespublic void registerMockResource(java.lang.String location,
java.lang.String contents)
location - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.propertiespublic void unregisterMockResource(java.lang.String location)
location - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.propertiespublic void registerIgnoredClassPathLocation(java.lang.String location)
location - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.propertiespublic void unregisterIgnoredClassPathLocation(java.lang.String location)
location - the location of the resource. Example: /WEB-INF/grails-app/i18n/messages.propertiespublic org.springframework.context.ApplicationContext getParent()
getParent in interface org.springframework.context.ApplicationContextpublic java.lang.String getId()
getId in interface org.springframework.context.ApplicationContextpublic java.lang.String getApplicationName()
getApplicationName in interface org.springframework.context.ApplicationContextpublic java.lang.String getDisplayName()
getDisplayName in interface org.springframework.context.ApplicationContextpublic long getStartupDate()
getStartupDate in interface org.springframework.context.ApplicationContextpublic void publishEvent(org.springframework.context.ApplicationEvent event)
publishEvent in interface org.springframework.context.ApplicationEventPublisherpublic boolean containsBeanDefinition(java.lang.String beanName)
containsBeanDefinition in interface org.springframework.beans.factory.ListableBeanFactorypublic int getBeanDefinitionCount()
getBeanDefinitionCount in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanDefinitionNames()
getBeanDefinitionNames in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(java.lang.Class type)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic java.lang.String[] getBeanNamesForType(java.lang.Class type,
boolean includePrototypes,
boolean includeFactoryBeans)
getBeanNamesForType in interface org.springframework.beans.factory.ListableBeanFactorypublic <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic <T> java.util.Map<java.lang.String,T> getBeansOfType(java.lang.Class<T> type,
boolean includeNonSingletons,
boolean allowEagerInit)
throws org.springframework.beans.BeansException
getBeansOfType in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic <A extends java.lang.annotation.Annotation> A findAnnotationOnBean(java.lang.String name,
java.lang.Class<A> annotation)
findAnnotationOnBean in interface org.springframework.beans.factory.ListableBeanFactorypublic java.util.Map<java.lang.String,java.lang.Object> getBeansWithAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotation)
throws org.springframework.beans.BeansException
getBeansWithAnnotation in interface org.springframework.beans.factory.ListableBeanFactoryorg.springframework.beans.BeansExceptionpublic java.lang.String[] getBeanNamesForAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Class has the supplied Annotation
type, without creating any bean instances yet.getBeanNamesForAnnotation in interface org.springframework.beans.factory.ListableBeanFactoryannotationType - the type of annotation to look forpublic java.lang.Object getBean(java.lang.String name)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> T getBean(java.lang.String name,
java.lang.Class<T> requiredType)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic <T> T getBean(java.lang.Class<T> tClass)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic java.lang.Object getBean(java.lang.String name,
java.lang.Object... args)
throws org.springframework.beans.BeansException
getBean in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.BeansExceptionpublic java.lang.Object getProperty(java.lang.String name)
getProperty in interface groovy.lang.GroovyObjectgetProperty in class groovy.lang.GroovyObjectSupportpublic boolean containsBean(java.lang.String name)
containsBean in interface org.springframework.beans.factory.BeanFactorypublic boolean isSingleton(java.lang.String name)
isSingleton in interface org.springframework.beans.factory.BeanFactorypublic boolean isPrototype(java.lang.String s)
isPrototype in interface org.springframework.beans.factory.BeanFactorypublic boolean isTypeMatch(java.lang.String name,
java.lang.Class aClass)
isTypeMatch in interface org.springframework.beans.factory.BeanFactorypublic java.lang.Class getType(java.lang.String name)
throws org.springframework.beans.factory.NoSuchBeanDefinitionException
getType in interface org.springframework.beans.factory.BeanFactoryorg.springframework.beans.factory.NoSuchBeanDefinitionExceptionpublic java.lang.String[] getAliases(java.lang.String name)
getAliases in interface org.springframework.beans.factory.BeanFactorypublic org.springframework.beans.factory.BeanFactory getParentBeanFactory()
getParentBeanFactory in interface org.springframework.beans.factory.HierarchicalBeanFactorypublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.lang.String defaultMessage,
java.util.Locale locale)
getMessage in interface org.springframework.context.MessageSourcepublic java.lang.String getMessage(java.lang.String code,
java.lang.Object[] args,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic java.lang.String getMessage(org.springframework.context.MessageSourceResolvable resolvable,
java.util.Locale locale)
throws org.springframework.context.NoSuchMessageException
getMessage in interface org.springframework.context.MessageSourceorg.springframework.context.NoSuchMessageExceptionpublic org.springframework.core.io.Resource[] getResources(java.lang.String locationPattern)
throws java.io.IOException
getResources in interface org.springframework.core.io.support.ResourcePatternResolverjava.io.IOExceptionpublic org.springframework.core.io.Resource getResource(java.lang.String location)
getResource in interface org.springframework.core.io.ResourceLoaderpublic boolean containsLocalBean(java.lang.String arg0)
containsLocalBean in interface org.springframework.beans.factory.HierarchicalBeanFactorypublic org.springframework.beans.factory.config.AutowireCapableBeanFactory getAutowireCapableBeanFactory()
throws java.lang.IllegalStateException
getAutowireCapableBeanFactory in interface org.springframework.context.ApplicationContextjava.lang.IllegalStateExceptionpublic java.lang.ClassLoader getClassLoader()
getClassLoader in interface org.springframework.core.io.ResourceLoaderpublic javax.servlet.ServletContext getServletContext()
getServletContext in interface org.springframework.web.context.WebApplicationContextpublic void setServletContext(javax.servlet.ServletContext servletContext)
public org.springframework.core.env.Environment getEnvironment()
getEnvironment in interface org.springframework.core.env.EnvironmentCapable