BeanFactory not initialized or already closed - call ‘refresh’ before accessing beans via the ApplicationContext
ApplicationContext ac = new ClassPathXmlApplicationContext();
這個錯誤是 applicationContext.xml 文件沒有被加載
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
xml文件在src路徑下