温馨提示×

springboot启动怎么指定properties

小亿
94
2024-07-27 01:00:08
栏目: 深度学习

在Spring Boot应用程序中,可以通过在命令行中使用–spring.config.location参数来指定properties文件的位置。例如,可以使用以下命令来启动Spring Boot应用程序并指定一个名为custom.properties的配置文件:

java -jar your-application.jar --spring.config.location=classpath:/custom.properties

这将告诉Spring Boot在类路径下查找名为custom.properties的配置文件,并加载其中的配置。您还可以指定其他文件路径,如绝对路径或相对路径,以便加载不同位置的配置文件。

0