我使用GWT與春天。我遇到了在RemoteServiceServlet
中使用@Autowired
bean的問題。出於某種原因,這不會自動工作,我需要使用@Configurable
才能正常工作。我跟着this approach,但我仍然得到了NullPointerException
爲@Autowired
豆:RemoteServiceServlet與春天autowired給nullpointerexception
@Configurable
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public class AServiceImpl extends RemoteServiceServlet implements AService {
@Autowired
private IABean aBean;
@Override
public void aMethodFromAService(Args arg[]) {
aBean.aMethodOfABean(); // this gives a NullPointerException
}
}
@Component
public class ABean implements IABean {
...
}
中正在發生的事情的任何指導?我需要提供哪些額外信息?
你在哪裏/你如何在春季宣佈你的ABean? XML或註釋? – spiritwalker 2013-02-13 12:29:33
註釋,已編輯原文 – Vjeetje 2013-02-13 12:33:56
您是否在應用程序上下文文件中具有以使ABean成爲注入的候選人。 –
spiritwalker
2013-02-13 12:38:03