Spring+SpringMVC+Hibernate整合实例讲解

网友投稿 602 2023-06-20

Spring+SpringMVC+Hibernate整合实例讲解

Spring+SpringMVC+Hibernate整合实例讲解

使用Maven构建项目,用pom.xml引入相应jar,配置以下文件

创建spring.xml:

xmlns="http://springframework.org/schema/beans"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.3.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.3.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.3.xsd">

xmlns="http://springframework.org/schema/beans"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:tx="http://springframework.org/schema/tx"

xsi:schemaLocation="http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.3.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.3.xsd

http://springframework.org/schema/tx http://springframework.org/schema/tx/spring-tx-4.3.xsd">

创建springmvc.xml

xmlns="http://springframework.org/schema/beans"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.3.xsd

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.3.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.3.xsd">

application/json;charset=utf-8

xmlns="http://springframework.org/schema/beans"

xmlns:aop="http://springframework.org/schema/aop"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc-4.3.xsd

http://springframework.org/schema/beans http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context-4.3.xsd

http://springframework.org/schema/aop http://springframework.org/schema/aop/spring-aop-4.3.xsd">

application/json;charset=utf-8

创建hibernate.cfg.xml

"-//Hibernate/Hibernate Configuration DTD 3.0//EN"

"http://hibernate.org/dtd/hibernaQMLLdDiwTte-configuration-3.0.dtd">

org.hibernate.dialect.mysql5InnoDBDialect

true

true

update

4

创建db.properties

jdbc.driver=com.mysql.cj.jdbc.Driver

jdbc.url=jdbc:mysql://localhost:3306/数据库名

jdbc.username="" #这里自己填写

jdbc.password="" #这里自己填写

整合SSH的配置文件已经完成

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:IDEA JetBrains Mono字体介绍和安装教程(详解)
下一篇:Spring Hystrix熔断报警原理图例解析
相关文章

 发表评论

暂时没有评论,来抢沙发吧~