原来是调用方法有误正确调用方法:
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
com.springmvc.hibernate.NewsDAO newsdao=(NewsDAO) ctx.getBean("NewsDAO");
com.springmvc.hibernate.News news=new com.springmvc.hibernate.News();
news.setId();
news.setTitle("");
news.setContents("");
news.setUpdatetime( new Timestamp(System.currentTimeMillis()));
newsdao.save(news);
错误调用方法:
com.springmvc.hibernate.NewsDAO newsdao =new com.springmvc.hibernate.NewsDAO ();