⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 beanfactorydemo4.java

📁 随书光盘:精通Sping 2.0 的随书源代码
💻 JAVA
字号:
package test;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.springframework.beans.factory.BeanFactory;import org.springframework.beans.factory.xml.XmlBeanFactory;import org.springframework.core.io.ClassPathResource;import org.springframework.core.io.Resource;/** * 演示构造器注入 *  * @author worldheart */public class BeanFactoryDemo4 {	protected static final Log log = LogFactory.getLog(BeanFactoryDemo4.class);	public void getContent(){		//从classpath路径上装载XML配置信息		Resource resource = new ClassPathResource("beanFactory4.xml");		//实例化IoC容器		BeanFactory factory = new XmlBeanFactory(resource);		//获得受管POJO		IHelloStr hs1 = (IHelloStr) factory.getBean("fileHello1");		IHelloStr hs2 = (IHelloStr) factory.getBean("fileHello2");		IHelloStr hs3 = (IHelloStr) factory.getBean("fileHello3");		IHelloStr hs4 = (IHelloStr) factory.getBean("fileHello4");		IHelloStr hs5 = (IHelloStr) factory.getBean("fileHello5");		IHelloStr hs6 = (IHelloStr) factory.getBean("fileHello6");		IHelloStr hs7 = (IHelloStr) factory.getBean("fileHello6");	}	public static void main(String[] args) {		BeanFactoryDemo4 bfd = new BeanFactoryDemo4();		bfd.getContent();	}	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -