开发者

spring hibernate - dao.save(object) return null pointer exception

can anyone help me with the following开发者_如何学C thread? http://forum.springsource.org/showthread.php?110248-dao.save%28object%29-java.lang.NullPointerException&p=365538#post365538

Many thannks


Spring didn't inject PatientDaoImp into your controller. Try this:

public class PatientController {

  @Autowired
  private PatientDaoImp dao;

Also make sure the following declaration is in your *-servlet.xml context file (not the main context file):

<context:component-scan base-package="com.pems.web"/>


In addition please add:

<context:annotation-config/> 

to you *-servlet.xml file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜