Spring Boot多环境指定yml或者properties

Spring Boot多环境指定yml或者properties

文章目录

加载顺序

● application-local.properties

● application.properties

● application-local.yml

● application.yml

application.propertes

properties 复制代码
server.port=8111

application-local.propertes

properties 复制代码
server.port=8222

application.yml

yml 复制代码
spring:
  profiles:
    active: local

application-local.yml

yml 复制代码
server:
  port: 8081

配置指定某个yml

yml 复制代码
spring:
  profiles:
    active: local

删除properties之后,项目启动

2023-08-23 09:38:29.423 INFO 22896 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8081 (http) with context path ''

2023-08-23 09:38:29.819 INFO 22896 --- [ main] c.g.s.SpringBootSelfExerciseApplication : Started SpringBootSelfExerciseApplication in 9.315 seconds (JVM running for 11.995)

相关推荐
Codebee7 分钟前
“自举开发“范式:OneCode如何用低代码重构自身工具链
java·人工智能·架构
星星电灯猴14 分钟前
iOS 性能调试全流程:从 Demo 到产品化的小团队实战经验
后端
程序无bug23 分钟前
手写Spring框架
java·后端
程序无bug25 分钟前
Spring 面向切面编程AOP 详细讲解
java·前端
JohnYan25 分钟前
模板+数据的文档生成技术方案设计和实现
javascript·后端·架构
全干engineer36 分钟前
Spring Boot 实现主表+明细表 Excel 导出(EasyPOI 实战)
java·spring boot·后端·excel·easypoi·excel导出
Da_秀40 分钟前
软件工程中耦合度
开发语言·后端·架构·软件工程
Fireworkitte1 小时前
Java 中导出包含多个 Sheet 的 Excel 文件
java·开发语言·excel
GodKeyNet1 小时前
设计模式-责任链模式
java·设计模式·责任链模式
蓝易云1 小时前
Qt框架中connect()方法的ConnectionType参数使用说明 点击改变文章字体大小
linux·前端·后端