lookupdemo.java

来自「随书光盘:精通Sping 2.0 的随书源代码」· Java 代码 · 共 36 行

JAVA
36
字号
package test;import org.apache.commons.logging.Log;import org.apache.commons.logging.LogFactory;import org.springframework.beans.factory.generic.GenericBeanFactoryAccessor;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;/** * 查找方法注入 *  * @author worldheart */public class LookupDemo {	protected static final Log log = LogFactory.getLog(LookupDemo.class);	public static void main(String[] args) {		//实例化IoC容器		ApplicationContext aac = new ClassPathXmlApplicationContext("lookup.xml");		GenericBeanFactoryAccessor gbfa = new GenericBeanFactoryAccessor(aac);				//获得受管POJO		LookupBeanImpl lb = gbfa.getBean("lookupBean");				log.info(lb.createAbstractLookedBean());		log.info(lb.createAbstractLookedBean());				log.info(lb.createLookedBean());		log.info(lb.createLookedBean());				log.info(lb.getCount());			log.info(lb.getName());			}	}

⌨️ 快捷键说明

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