标签:兼容 pre 自动装配 classpath return this name int import
package auto_w; /** * Created by luozhitao on 2017/8/8. */ public class ablity { public void setWrite_able1(String write_able1) { this.write_able1 = write_able1; } public String getWrite_able1() { return write_able1; } private String write_able1; }
package auto_w; /** * Created by luozhitao on 2017/8/8. */ public class Person { public void setLity(ablity lity) { this.lity = lity; } public ablity getLity() { return lity; } private ablity lity; }
package auto_w; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** * Created by luozhitao on 2017/8/8. */ public class p_app { public static void main(String [] args){ ApplicationContext context=new ClassPathXmlApplicationContext("beans.xml"); Person person=(Person)context.getBean("person"); System.out.println(person.getLity().getWrite_able1()); } }
<bean id="person" class="auto_w.Person" autowire="byType"></bean> <bean id="ablity" class="auto_w.ablity"> <property name="write_able1" value="write"/> </bean>
标签:兼容 pre 自动装配 classpath return this name int import
原文地址:http://www.cnblogs.com/luo-mao/p/7309573.html