对application.yml里面所有属性进行详解
时间: 2023-08-06 14:04:42 浏览: 116
application.yml 是 Spring Boot 中常用的配置文件,可以用来配置应用程序的属性。下面是一些常见的属性及其含义:
server:
port: 8080
servlet:
context-path: /demo
spring:
application:
name: demo
profiles:
active: dev
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/demo?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
username: root
password: root
hikari:
connection-timeout: 30000
maximum-pool-size: 10
minimum-idle: 5
jpa:
hibernate:
ddl-auto: update
show-sql: true
thymeleaf:
cache: false
logging:
level:
root: debug
server.port
:应用程序监听的端口号。server.servlet.context-path
:应用程序的上下文路径。spring.application.name
:应用程序的名称。spring.profiles.active
:指定当前使用哪个环境配置文件,比如 dev、test、prod 等。spring.datasource.driver-class-name
:指定数据库驱动类名。spring.datasource.url
:指定数据库的连接 URL。spring.datasource.username
:指定数据库的用户名。spring.datasource.password
:指定数据库的密码。spring.datasource.hikari.connection-timeout
:连接池中获取连接的超时时间,单位是毫秒。spring.datasource.hikari.maximum-pool-size
:连接池的最大连接数。spring.datasource.hikari.minimum-idle
:连接池中保持空闲状态的最小连接数。spring.jpa.hibernate.ddl-auto
:指定数据库表结构的生成策略,比如 create、update、validate 等。spring.jpa.show-sql
:是否打印 SQL 语句。spring.thymeleaf.cache
:是否启用 Thymeleaf 模板缓存。logging.level.root
:指定日志级别,比如 DEBUG、INFO、WARN、ERROR 等。
这些属性只是 application.yml 中的一部分,具体应用场景和属性含义可能会因项目而异。
阅读全文
相关推荐


















