关于环境的选择问题
来源:2-8 搭建数据库与持久层框架(二)

梁仙森
2022-07-02
这里写的test,是如何判断使用哪个properties文件的?根据文件名称里面包含test名称来决定的吗?
写回答
1回答
-
不知为了什么
2023-05-15
application-{profile}.properties 的格式,其中 {profile} 对应你的环境标识
application.properties:默认配置 application-dev.properties:开发环境 application-test.properties:测试环境 application-prod.properties:生产环境至于哪个具体的配置文件会被加载,需要在 application.properties 文件中通过 spring.profiles.active 属性来设置,其值对应 {profile} 值。
如:spring.profiles.active=test 就会加载 application-test.properties 配置文件内容
00
相似问题