Example usage for Java org.springframework.context.annotation AnnotationConfigApplicationContext fields, constructors, methods, implement or subclass
The text is from its open source code.
AnnotationConfigApplicationContext(DefaultListableBeanFactory beanFactory) Create a new AnnotationConfigApplicationContext with the given DefaultListableBeanFactory. | |
AnnotationConfigApplicationContext(Class>... annotatedClasses) Create a new AnnotationConfigApplicationContext, deriving bean definitions from the given annotated classes and automatically refreshing the context. | |
AnnotationConfigApplicationContext(String... basePackages) Create a new AnnotationConfigApplicationContext, scanning for bean definitions in the given packages and automatically refreshing the context. | |
AnnotationConfigApplicationContext() Create a new AnnotationConfigApplicationContext that needs to be populated through #register calls and then manually #refresh refreshed . |
void | addApplicationListener(ApplicationListener> listener) |
void | addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor) |
void | close() Close this application context, destroying all beans in its bean factory. |
boolean | containsBean(String name) |
void | destroy() Callback for destruction of this instance, originally attached to a DisposableBean implementation (not anymore in 5.0). |
AutowireCapableBeanFactory | getAutowireCapableBeanFactory() |
T | getBean(String name, Class |
Object | getBean(String name) |
String[] | getBeanDefinitionNames() |
ConfigurableListableBeanFactory | getBeanFactory() Return the single internal BeanFactory held by this context (as ConfigurableListableBeanFactory). |
List | getBeanFactoryPostProcessors() Return the list of BeanFactoryPostProcessors that will get applied to the internal BeanFactory. |
String[] | getBeanNamesForType(ResolvableType type) |
Map | getBeansOfType(@Nullable Class |
Map | getBeansWithAnnotation(Class extends Annotation> annotationType) |
DefaultListableBeanFactory | getDefaultListableBeanFactory() Return the underlying bean factory of this context, available for registering bean definitions. |
ConfigurableEnvironment | getEnvironment() Return the Environment for this application context in configurable form, allowing for further customization. |
String | getId() |
boolean | isPrototype(String name) |
boolean | isRunning() |
boolean | isSingleton(String name) |
void | refresh() |
void | register(Class>... annotatedClasses) Register one or more annotated classes to be processed. |
void | registerBeanDefinition(String beanName, BeanDefinition beanDefinition) |
void | registerShutdownHook() Register a shutdown hook with the JVM runtime, closing this context on JVM shutdown unless it has already been closed at that time. |
void | scan(String... basePackages) Perform a scan within the specified base packages. |
void | setAllowBeanDefinitionOverriding(boolean allowBeanDefinitionOverriding) Set whether it should be allowed to override bean definitions by registering a different definition with the same name, automatically replacing the former. |
void | setAllowCircularReferences(boolean allowCircularReferences) Set whether to allow circular references between beans - and automatically try to resolve them. |
void | setClassLoader(@Nullable ClassLoader classLoader) |
void | setDisplayName(String displayName) Set a friendly name for this context. |
void | setEnvironment(ConfigurableEnvironment environment) Propagates the given custom Environment to the underlying AnnotatedBeanDefinitionReader and ClassPathBeanDefinitionScanner . |
void | setId(String id) Set the unique id of this application context. |
void | setParent(@Nullable ApplicationContext parent) Set the parent of this application context, also setting the parent of the internal BeanFactory accordingly. |
void | setResourceLoader(ResourceLoader resourceLoader) Set a ResourceLoader to use for this context. |
void | start() |
void | stop() |