Spring Boot 配置文件详解:application.properties & application.yml
Spring Boot 的基本配置文件是 application.properties 或 application.yml,其内容包括:
- 服务器端口号:
server.port=8080 - 应用名称:
spring.application.name=myapp - 数据库连接信息:
spring.datasource.url=jdbc:mysql://localhost:3306/mydb - 数据库用户名:
spring.datasource.username=root - 数据库密码:
spring.datasource.password=mypassword - 日志级别:
logging.level.root=INFO - 静态资源路径:
spring.resources.static-locations=classpath:/static/ - 模板引擎配置:
spring.thymeleaf.cache=false - 国际化配置:
spring.messages.basename=messages - 其他自定义配置。
这些配置项可以根据具体应用的需要进行修改和扩展。
原文地址: https://www.cveoy.top/t/topic/lB7p 著作权归作者所有。请勿转载和采集!