当前位置:网站首页>application. Yaml configuring multiple running environments

application. Yaml configuring multiple running environments

2022-06-24 01:56:00 Code siege lion

I omitted the terminator here …

Exhibition :

 Insert picture description here

Code :

---
#  Define a set of production environments in this document 
server:
  port: 8081
  servlet:
    context-path: /p8081

spring:
  config:
    activate:
      on-profile: pro

---
#  Define a set of test environment in this document 
server:
  port: 8082
  servlet:
    context-path: /p8082

spring:
  config:
    activate:
      on-profile: test

---

The production environment can be started by command

hold SpringBoot Project package
Then select the release production environment through the command
1、 First use maven Package the project
 Insert picture description here
2、 After compilation , Start by command
 Insert picture description here
Then press the keyboard Shift+ Right mouse button , Click this command to enter

, Type this command
 Insert picture description here

It can also be done through IDEA To start the configuration

1、
 Insert picture description here
2、
 Insert picture description here
3、
 Insert picture description here
4、
 Insert picture description here

原网站

版权声明
本文为[Code siege lion]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202211654167401.html

随机推荐