Saturday, February 2, 2019

Exception in thread "main" java.lang.IllegalStateException

When you have input like this below

ApplicationContext applicationContext = new ClassPathXmlApplicationContext();

you get output like

Exception in thread "main" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

Hence you have to define the bean in the ClassPathXmlApplicationContext("SpringBeans.xml");

No comments:

Post a Comment