Reputation: 179
i am learning spring from quite some time now and i have researched a lot about this,but couldn't find any satisfying answer. why would i want to use configurable application context? what are the benefits? . also saw the documentation but couldn't understand it.
Here is what the documentation says:
SPI interface to be implemented by most if not all application contexts. Provides means to configure an application context in addition to the application context client methods in the ApplicationContext interface.
Configuration and lifecycle methods are encapsulated here to avoid making them obvious to ApplicationContext client code.
Upvotes: 0
Views: 2645
Reputation: 7624
ApplicationContext gives you more of get/read only methods and encapsulated or doesn't allow Configuration and lifecycle methods.
e.g: you can ApplicationContext's implementation to load Configuration from XML
Most commonly used ApplicationContext implementations are
FileSystemXmlApplicationContext
ClassPathXmlApplicationContext
WebXmlApplicationContext
So all above implementation will not have methods to manage Configuration and lifecycle.
If you want more control over Life Cycle like Initialisation and Destruction, you can use ConfigurableApplicationContext
.
Here are few examples of using ConfigurableApplicationContext
https://www.javatips.net/api/org.springframework.context.configurableapplicationcontext
I have just rephrased answer given in this Post
Upvotes: 2