ITeye博客

Spring简单属性注入

kingge08 · 2011-06-03 19:51 · Spring3.0 · 企业架构 · Markdown

package com.zchen.property;

public class User {
	private int id;
	private String name;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	

}

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
           http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
  <bean id="user" class="com.zchen.property.User">
  	<property name="id" value="2" />
  	<property name="name" value="zchen" />
  </bean>
</beans>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。