解决No CurrentSessionContext configured!异常

解决No CurrentSessionContext configured!错误
只需在hibernate.cfg.xml的
<session-factory>
.....
</session-factory>中加入
<property name="hibernate.current_session_context_class">thread</property>
即可。