ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("xxx.xml");
applicationContext.start();
xxxService x = (xxxService) applicationContext.getBean("xxxService");
比较简单的方式,在主函数中测试Spring装配Bean的情况,不需要启动装个系统。
ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("xxx.xml");
applicationContext.start();
xxxService x = (xxxService) applicationContext.getBean("xxxService");
比较简单的方式,在主函数中测试Spring装配Bean的情况,不需要启动装个系统。