2V0-72.22PSE · Question #94
Which two statements describe the ApplicationContext correctly? (Choose two.)
The correct answer is C. The ApplicationContext can be created in a test environment, web application, and in a E. The ApplicationContext maintains singleton beans that are instantiated by the Spring runtime. C and E are correct because the ApplicationContext is a versatile container that works across multiple deployment contexts - you can instantiate it in unit/integration tests (e.g., AnnotationConfigApplicationContext), in standalone apps, and in web environments (e.g…
Question
Which two statements describe the ApplicationContext correctly? (Choose two.)
Options
- AThe ApplicationContext is the root interface for accessing the Spring container.
- BThe ApplicationContext lazy initializes beans by default.
- CThe ApplicationContext can be created in a test environment, web application, and in a
- DThe ApplicationContext does not include all functionality of the BeanFactory.
- EThe ApplicationContext maintains singleton beans that are instantiated by the Spring runtime.
How the community answered
(38 responses)- A5% (2)
- B3% (1)
- C87% (33)
- D5% (2)
Explanation
C and E are correct because the ApplicationContext is a versatile container that works across multiple deployment contexts - you can instantiate it in unit/integration tests (e.g., AnnotationConfigApplicationContext), in standalone apps, and in web environments (e.g., WebApplicationContext) - and by default it eagerly instantiates and caches all singleton beans at startup, maintaining them throughout the application lifecycle.
A is wrong because BeanFactory - not ApplicationContext - is the root interface for the Spring container; ApplicationContext extends BeanFactory and is a sub-interface, not the root.
B is wrong because it describes the opposite behavior: BeanFactory uses lazy initialization by default, while ApplicationContext eagerly initializes singleton beans at startup.
D is wrong because ApplicationContext is a superset of BeanFactory - it includes all BeanFactory functionality and adds extras like event publishing, i18n/message resolution, and AOP integration.
Memory tip: Think of ApplicationContext as a fully-loaded BeanFactory - it does everything BeanFactory does, starts beans up eagerly, and works anywhere (test, web, standalone). If a choice says it's "the root" or "lazy" or "missing features," it's describing BeanFactory, not ApplicationContext.
Topics
Community Discussion
No community discussion yet for this question.