spring中的idref元素
idref元素是一个简单的对容器中存在的另外一个bean的检错途径(通过id);
<idref
bean="someBeanId"/> ,不同于<ref/>
someBeanId注入的是一个字符串,相当于:
<property
name="targetName" value="someBeanId"/>
如果"someBeanId"不是其中一个bean的ID,将会报BeanDefinitionStoreException
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAABvUAAABCCAYAAABny1rrAAAlzUlEQVR4nO2dO28cx7KA+wInObuhTYYkATrQoZ0JCg04EkP9D4ZXv4PODv+HQioycEJBmcHjQARIhlw6XCq8d3oeu7Pz7OqZ6unZ/T5AoPbVU11dXV39/sfPP//8f2avODLXv70xl2ZlPv7xl7ndm2fFKsPUz49dniH45iUmHSDLfOSRMnf5QzC2jg5d5zHlP7QsMeU9BtD/vEB/ALpQx8KirW/KU0ZM+opJFi268jiH/HfJuDBX796aq6Uxt3f/MR+ftZ8XO3OUvZD51dx8+Wpu1j6/nWN+5yTzWBxy3l2Zs47m2N8Pr+9/dApw/Mb8eXG0+bTWsFU+Nz2O8/zsrfl0tii9M/VEVJk+WbYNfMr60Xz48t3xOW76dNdPk/z2veSfc34cEJavpZqHrmBIbA8e8mxYnphP707NuctzOinZQWoDT+a+8/2SDdwZc53Knz3/2yb/c3SwY7FbR7452Y+k/vrUlRH8g9NvXBma3yrdHZju74XSpzGXF7+a6+PSG89/mV/uVpVv+diPH27ylGWqvjeyf25skwq/U0fmb6X2oKl/H31K6qOffUoZpH+neEMD//IV5XenfS5Rs2n/uhWb/t3kkcYbJVTi87I9PJnzXv9ziO2Fh/zO9u+Pe/tVIOm/NNeXq7E6tGL/4GqfPvn1icek9ibRp69PHFC+LmkK+zv9/qeQoaffV9hKpbx17b9FhsZ8+DLjeE/Vv2nHhzlO7al/fKJjnx0TU8X3R2xjJERln40k5fu4MleJji5/PEp+t1sWeuN12u1LjOMn2vHb2tw7TejFVn+339YZP6d/0S7LLvH0LzSRyu/bvsQyXtoij8p4S5j47R+Nn1tqFdYa9Rvz+TlLtGbgm4TfmHs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AAAAAAAAAAAAAAAAAIodJPQAAAAAAAAAAAAAAAIDIYVIPAAAAAAAAAAAAAAAAIHKY1AMAAAAAAAAAAAAAAACIHCb1AAAAAAAAAAAAAAAAACKHST0AAAAAAAAAAAAAAACAyPl/NkPS0OkBLPIAAAAASUVORK5CYII=" alt="" name="图像1" width="643" height="24" align="left" border="0" />
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAHCAYAAADAp4fuAAAACXBIWXMAAA/hAAAOPgGKbpgdAAAAZklEQVR4nGP5//8/AzJ4/eGbNAsDGpi37WoViuDu0w/D9597HAQX3HL8Xvy09RdbpxY6uYIFtxy7lzBj08Wm6UXOzvISfDdZbj/5oDdh9bmeueVu1iABkCKW5XtvFMR5aHXBBEAAACkgKlRt4pNlAAAAAElFTkSuQmCC" alt="" align="left" />
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAYAAABhYU3QAAAACXBIWXMAAA5CAAASKwGRGEzpAAAAXUlEQVR4nAFSAK3/BP///wAAAAAA9/n8C7TG3mDR3es77vL4F/T3+g/u8/gWGhMM3ywiFMkE7fL3GKm+2m2vwttmMSYWwj4vHLIXEQrjDAkG8QwJBfLr8PcaztvpPiboKj9kKgxyAAAAAElFTkSuQmCC" alt="" align="left" />
详细代码如下:
配置文件:idref_check.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd"> <bean id="shihaofengqiu"
class="beans.Song"
p:title="十号风球"/> <bean id="xiaoming"
class="beans.Singer">
<property name="name" value="xiaoming"/>
<!--<property name="song" value="mrfanl"/>-->
<property name="song">
<!--<idref bean="mrfanl"/>--><!--报错-->
<idref bean="shihaofengqiu"/><!--通过-->
</property>
</bean>
</beans>
performer.java
package beans; public interface Performer {
public void play();
}
Singer.java
package beans; public class Singer implements Performer { private String name;
private String song; public Singer() { } public void setName(String name) {
this.name = name;
} public void setSong(String song) {
this.song = song;
} @Override
public void play() {
System.out.println("my name is:"+this.name);
System.out.println("my song is:"+this.song); }
}
Song.java
package beans; public class Song {
private String title; public Song(){} public String getTitle() {
return title;
} public void setTitle(String title) {
this.title = title;
}
}
test.java
package main; import beans.Performer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; public class test {
public static void main(String[] args){
ApplicationContext ctx = new ClassPathXmlApplicationContext("idref_check.xml");
Performer xiaoming = (Performer) ctx.getBean("xiaoming");
xiaoming.play();
}
}
结果: