BeanWrapper的使用

@Component
public class AppBoot implements CommandLineRunner {

	private String id;

	@Override
	public void run(String... args) throws Exception {
		BeanWrapper bw = PropertyAccessorFactory.forBeanPropertyAccess(this);
		bw.setPropertyValue("id", "1111111111111111111111111111111111");
		System.out.println(id);
	}

	/**
	 * @return the id
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章