框架——(配合mvc)spring(配置xml)

第一步,扫描带注解的类(扫描这个包)**注解(不能**@Service、@Controller、@Component等则不行,需要在mvc里配置)

框架——(配合mvc)spring(配置xml)

指定属性文件的位置(里面专门放置了jdbc数据源的配置和hibernate的配置)

框架——(配合mvc)spring(配置xml)

Bean配置数据源(引入属性文件的配置${})

框架——(配合mvc)spring(配置xml)

配置sessionfactory工厂(在里面**数据源,扫描带@entity注解的包,配置hibernate)

框架——(配合mvc)spring(配置xml)

Bean配置org.springframework.orm.hibernate5.HibernateTransactionManager,将sessionfactory纳入事务

使用annotation定义事务<tx:annotation-driven transaction-manager="transactionManager"/> 

框架——(配合mvc)spring(配置xml)