BeanFactory is suitable for lightweight applications with minimal configuration.
While BeanFactory has its benefits, it also has several limitations (which is why ApplicationContext is usually preferred):
Note: BeanFactory is an "Old Spring Container" so we should not use it in real world projects. Instead of BeanFactory we should use "ApplicationContext".
Interview Question : What is Difference between BeanFactory & ApplicationContext ?
Click Here for answer
ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
Your feedback helps us grow! If there's anything we can fix or improve, please let us know.
Weโre here to make our tutorials better based on your thoughts and suggestions.