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

📄 beanfactorydemo6.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;/** * 演示通过构造器注入factory-bean、factory-method所需的参数 *  * @author worldheart */public class BeanFactoryDemo6 {	protected static final Log log = LogFactory.getLog(BeanFactoryDemo6.class);	public void getContent() {		// 从classpath路径上装载XML配置信息		Resource resource = new ClassPathResource("beanFactory6.xml");		// 实例化IoC容器		BeanFactory factory = new XmlBeanFactory(resource);		// 获得受管POJO		ITestBean tb1 = (ITestBean) factory.getBean("test.TestBean");		ITestBean testBean = (ITestBean) factory.getBean("testBean");		ITestBean tB = (ITestBean) factory.getBean("tB");		ITestBean tb = (ITestBean) factory.getBean("tb");	}	public static void main(String[] args) {		BeanFactoryDemo6 bfd = new BeanFactoryDemo6();		bfd.getContent();	}}

⌨️ 快捷键说明

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