您的位置:首页 > 房产 > 建筑 > mybatis配置环境流程

mybatis配置环境流程

2024/10/7 6:43:50 来源:https://blog.csdn.net/weixin_40390585/article/details/139273421  浏览:    关键词:mybatis配置环境流程

mybatis配置环境流程

为啥要用mybatis:通过Mybatis实现快速访问后端pgsql、mysql等数据库。

1.修改pom.xml,添加mybatis相关依赖

<dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>1.3.2</version>
</dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId>
</dependency>

2.修改application.yml,修改数据库连接信息

这个application.yml我没有,所以我要在resources这个文件夹目录新建一个。建完之后放入这个代码。注意:配置url,username和password三个参数,依据自己pgsql的环境

spring:application:name: spring-boot-tutorialdatasource:driverClassName: org.postgresql.Driverurl: jdbc:postgresql://127.0.0.1:5432/tvseries?stringtype=unspecified&ApplicationName=tutorialusername: postgrespassword: 123456jackson:serialization:write-dates-as-timestamps: true  #使用数值timestamp表示日期mybatis.configuration.mapUnderscoreToCamelCase: true

这样下来mybatis应该算是配置好了,不过应该测试一下,不过我还没学测试,所以先掠过。

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com