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.
精彩评论