如何在Java Spring中设置Run Configuration的环境区域,STS?

huangapple go评论90阅读模式
英文:

How to set Run Configuration's environment region in Java Spring, STS?

问题

我正在尝试在STS本地运行一个Java Spring项目,而不是在服务器上运行。这个项目接受一个REGION,我想将其设置为DEV,并且我想在运行配置中设置它,以便不出现这种情况:“java.lang.RuntimeException: 必需的环境变量REGION有问题!”

任何帮助,可能附带截图或其他内容将不胜感激,谢谢。

英文:

I am trying to run a Java Spring project in STS locally rather than on the server. This project takes on a REGION which I am trying to set to DEV, and I'd like to set it in Run Configurations so that I don't get this: "java.lang.RuntimeException: Problem with required environment variable REGION!"

Any help, possibly with screenshots or something would be very appreciated, thanks.

答案1

得分: 0

  1. 通过菜单 <kbd>运行</kbd> <kbd>运行配置</kbd> <kbd>参数(第二选项卡)</kbd> 添加VM参数 -DREGION=DEV

  2. 通过菜单 <kbd>运行</kbd> <kbd>运行配置</kbd> <kbd>环境(第六选项卡)</kbd> <kbd>添加...</kbd> 参数 REGION = DEV

注意:如果您同时使用这两个选项,那么VM参数 -DREGION=DEV 将生效。

VM参数可用于通过CLI启动您的应用程序:

java -DREGION=DEV -jar your_nice_app.jar

英文:

Multiple options here:

  1. Via menu <kbd>Run</kbd> <kbd>Run Configurations</kbd> <kbd>Arguments (second tab)</kbd>
    add VM arguments -DREGION=DEV

  2. Via menu <kbd>Run</kbd> <kbd>Run Configurations</kbd> <kbd>Environment (tab six)</kbd>
    <kbd>Add...</kbd> arguments REGION = DEV

Note: if you use both options, then VM arguments -DREGION=DEV will win

VM arguments can be used to launch your app via CLI:

java -DREGION=DEV -jar your_nice_app.jar

huangapple
  • 本文由 发表于 2020年8月13日 01:33:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/63381900.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定