1. web.xml中别忘记加入spring监听器 <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener>
2. 注意bean的id(datasource)和sessionfactory引入的datasource名字要完全相同