testbean.java

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

JAVA
63
字号
package test;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Required;

/**
 * 
 * 
 * @author worldheart
 *
 */
public class TestBean implements ITestBean {

	protected static final Log log = LogFactory.getLog(TestBean.class);
	
	private HelloWorld hw1;
	
	private HelloWorld hw2;
	
	private String str;
	
	public HelloWorld getHw1() {
		return hw1;
	}
		
	public HelloWorld getHw2() {
		return hw2;
	}
	
	public String getStr() {
		return str;
	}
	
	@Required
	public void setHw1(HelloWorld hw1) {
		this.hw1 = hw1;
	}
	
	@Required
	public void setHw2(HelloWorld hw2) {
		this.hw2 = hw2;
	}
	
	@Required
	public void setStr(String str) {
		this.str = str;
	}	
	
	public void testBean() {
		if(this.hw1  != null){
			log.info("hw1对象不为null!");
		}
		if(this.hw2  != null){
			log.info("hw2对象不为null!");
		}
		if(this.str != null){
			log.info("str不为null!");
		}
	}
	
}

⌨️ 快捷键说明

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