Spring Boot 配置文件:使用 MySQL 和 MyBatis Plus
基本的 Spring Boot 配置文件是 'application.yml' 或 'application.properties'。这个文件包含了应用程序的各种配置信息,如应用程序的端口、日志级别、数据库连接等。
如果需要使用数据库和 MyBatis Plus,需要在配置文件中添加以下内容:
spring:
datasource:
url: jdbc:mysql://localhost:3306/mydb?serverTimezone=Asia/Shanghai&useSSL=false&allowPublicKeyRetrieval=true
username: root
password: root
driver-class-name: com.mysql.cj.jdbc.Driver
mybatis-plus:
mapper-locations: classpath:/mapper/*.xml
type-aliases-package: com.example.demo.entity
其中,'spring.datasource' 包含了数据库的连接信息,'mybatis-plus' 包含了 MyBatis Plus 的配置信息。具体的配置内容可以根据实际情况进行修改。
原文地址: https://www.cveoy.top/t/topic/lB7q 著作权归作者所有。请勿转载和采集!