2016-12-16 36 views
0

初始化屬性我有一個非簧bean類,看起來像這樣:使用一個Spring bean的依賴

public class ReportFilterManager implements Serializable { 

private static final long serialVersionUID = 1L; 
@SpringBean 
private IControllersConfigService controllersConfigService; 

private List<String> fromGroupOfControllers = controllersConfigService.getAllGroupOfControllersNames(); 

我想用的Spring bean controllersConfigService的方法給init fromGroupOfControllers領域。什麼是最好的方式來做到這一點?

回答

0

我想說最好的方法是通過controllersConfigService作爲方法或構造參數。

您實例化ReportFilterManager的類應找到方法來以某種方式獲得controllersConfigService

相關問題