通过Spring的哪个类的哪个方法得到bean
来源:百度知道 编辑:UC知道 时间:2024/06/20 17:37:21
BeanFactory bean = new ClassPathXmlApplicationContext("applicationContext.xml");
XXService service = (XXService) bean.getBean("beanName");
一楼的方法正确。获取方式建议做成工具类。
一楼方法正解
UC知道是一部内容开放、自由的互动网络百科全书
客观、专业、权威的知识性百科全书
来源:百度知道 编辑:UC知道 时间:2024/06/20 17:37:21
BeanFactory bean = new ClassPathXmlApplicationContext("applicationContext.xml");
XXService service = (XXService) bean.getBean("beanName");
一楼的方法正确。获取方式建议做成工具类。
一楼方法正解