什麼是Spring 3.2的默認自動裝配方法?讓我們說我有這個類Spring 3.2默認值爲@Autowired
public class Saxophonist implements IPerform{
@Override
public String perform() {
return "I am A Saxophonist and I am Playing The : "+ saxophone;
}
private Instrument saxophone;
public Instrument getSaxophone() {
return saxophone;
}
@Autowired
public void setSaxophone(Instrument saxophone) {
this.saxophone = saxophone;
}
}
它會執行byName或將執行byType嗎?
Autowired的後備功能是什麼?以及如何將@Autowired的默認方法設置爲byName而不是byType? – user962206 2013-02-14 10:08:23
@ user962206我更新了回答您的問題 – 2013-02-14 10:14:10