springboot中自己常用的application.properties的配置和application.yml的配置

springboot中application.properties相关的基础配置
#MySQL端口配置
#server.port=8080
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/blog1(数据库名称)?charset=utf8mb4&useSSL=false&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC
spring.datasource.username=(数据库账号)
spring.datasource.password=(数据库密码)

上下文数据配置

server.servlet.context-path=/demo(上下文所需要的路径名)

Hikari 数据源专用配置

spring.datasource.hikari.maximum-pool-size=20
spring.datasource.hikari.minimum-idle=5

JPA 相关配置

spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.show-sql=true
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
#spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.hbm2ddl.auto=update
spring.freemarker.check-template-location=false
logging.level.root=info
logging.level.com.lrm=debug
logging.file=log/blog-dev.log
spring.thymeleaf.mode=HTML
spring.thymeleaf.suffix=.html
spring.thymeleaf.prefix=classpath:/templates/
#github配置
github.client.id=24233a5a0ff6abf981da
github.client.secret=290f422bcbc4081ae36779e53ea4be08880ada5a
github.redirect.uri=http://localhost:8080/callback
#mybatis的配置
mybatis.mapper-locations=classpath:mapping/*.xml

#ymlMySQL数据库基础配置
#注意,:后边要有空格
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: 账号
password: 冒号
url: jdbc:mysql://localhost:3306/数据库名?charset=utf8mb4&useSSL=false&useJDBCCompliantTimezoneShift=true&serverTimezone=UTC
jpa:
show-sql: true

你可能感兴趣的:(springboot,MySQL)