#server配置
server:
port: 8080 #设置端口
servlet:
context-path: / #监听端口路径,默认为 /
#spring配置
spring:
datasource: #数据库配置
driver-class-name: com.mysql.cj.jdbc.Driver #配置连接池
url: jdbc:mysql://127.0.0.1:3306/jtsys?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=utf8
#数据库路径,serverTimezone=GMT是时区设置,并设置为utf-8
username: root #数据库用户名
password: root #数据库密码
thymeleaf:
prefix: classpath:/templates/ # 页面的存储路径
suffix: .html #页面的后缀名
#mybatis配置
mybatis:
configuration:
default-statement-timeout: 30 #执行SQL超时时间为30秒,保护数据库
map-underscore-to-camel-case: true #开启驼峰命名
mapper-locations:
- classpath:/mapper/*/*.xml #配置写SQL语句的mapper.xml文件路径
#jpa配置
jpa:
generate-ddl: true
hibernate:
ddl-auto: create
ddl-auto: update
show-sql: true
database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
#lOG日志配置
logging:
level: DEBUG
在创建sringboot项目时常用的application.yml文件配置,具体配置需要结合自己的项目需要而定。
最新推荐文章于 2024-06-13 21:12:10 发布
本文详细解析了Spring Boot项目的配置细节,包括server端口及路径设置、数据库连接配置、Thymeleaf模板引擎配置、MyBatis框架配置、JPA配置以及日志级别设置等,为开发者提供全面的配置指南。
673

被折叠的 条评论
为什么被折叠?



