- 设置临时环境变量, 终端关闭, 则杀死临时变量.
- 设置 set DB_HOST=8089
- 输出查看 echo %DB_HOST%
- DB_HOST:8081
- 如果在环境变量中找到了DB_HOST, 那么就用DB_HOST; 如果说没有找到, 就用8081端口.
- 输出日志
- Tomcat started on port(s): 8089 (http) with context path '/basic_project'
- 代码配置
server:
# 服务器端口号
port: ${DB_HOST:8081}
servlet:
context-path: /basic_project