05_springboot多配置文件

1.多配置文件,其中application.properties中的spring.profiles.active能够灵活的切换使用环境

application.properties

spring.mvc.view.prefix=/WEB-INF/jsp/
spring.mvc.view.suffix=.jsp
spring.profiles.active=pro

application-dev.properties

server.port=8080
server.context-path=/test

application-pro.properties

server.port=80
server.context-path=/

2.部署,在项目目录下生成jar包mvn install

在pro环境下运行

image-20201110084937318

在dev环境下运行

image-20201110085024608
原文地址:https://www.cnblogs.com/NaoDaiYouDianDa/p/13992402.html