springboot

springboot如何指定启动配置文件

小亿
1094
2024-06-06 14:19:17
栏目: 编程语言

Spring Boot 默认会加载以下位置的 application.properties 或 application.yml 文件作为启动配置文件:

如果想要指定其他位置的配置文件作为启动配置文件,可以在启动时使用 --spring.config.location 参数指定,例如:

java -jar your-app.jar --spring.config.location=classpath:/custom-config.yml

以上示例表示指定 classpath 下的 custom-config.yml 文件作为启动配置文件。

0
看了该问题的人还看了