标签:enc const ddr jin return XML over 属性 gate
Spring IOC 容器可以自动装配 Bean. 需要做的仅仅是在 <bean> 的 autowire 属性里指定自动装配的模式
IDEA 会有提示 :Navigate to the autowired dependencies
<bean id="address" class="yang.mybatis.test.Address" p:city="BeiJing" p:street="TianAnMen"></bean> <bean id="car" class="yang.mybatis.test.Car" p:name="奥迪89" p:brand="奥迪" p:price="300"></bean> <bean id="person" class="yang.mybatis.test.Person" p:name="xiaoming" autowire="byName"></bean>
package yang.mybatis.test; import java.util.List; import java.util.Map; /** * Created by yangshijing on 2017/11/29 0029. */ public class Person { private String name; private Address address; private Car car; public Person() { } public Person(Address address, Car car, String name) { this.address = address; this.car = car; this.name = name; } public Address getAddress() { return address; } public void setAddress(Address address) { this.address = address; } public Car getCar() { return car; } public void setCar1(Car car) { this.car = car; } public String getName() { return name; } public void setName(String name) { this.name = name; } @Override public String toString() { return "Person{" + "address=" + address + ", name=‘" + name + ‘\‘‘ + ", car=" + car + ‘}‘; } }
标签:enc const ddr jin return XML over 属性 gate
原文地址:http://www.cnblogs.com/realshijing/p/7929240.html