【问题标题】:Unable to use command line arguments to start spring boot aplication无法使用命令行参数启动 Spring Boot 应用程序
【发布时间】:2017-03-08 21:37:39
【问题描述】:

我的系统上设置了以下内容。

  1. Ubuntu 16.04
  2. Gradle 3.0
  3. Java 1.8.0_91
  4. springBootVersion:1.4.0.RELEASE

我正在使用以下参数从命令行运行 Spring Boot 应用程序。

gradle -Dserver.port=8090 -Dspring.profiles.active=dev bootRun

以下是日志

Starting a Gradle Daemon, 3 stopped Daemons could not be reused, use --status for details
No active profile set, falling back to default profiles: default
Registering beans for JMX exposure on startup
2016-10-26 18:36:00.463  INFO 27743 --- [  restartedMain] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2016-10-26 18:36:00.584  INFO 27743 --- [  restartedMain] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)

当我做 gradle --status 结果是

No Gradle daemons are running.
   PID STATUS   INFO
 26929 STOPPED  (client disconnected)
 27086 STOPPED  (client disconnected)
 27202 STOPPED  (client disconnected)
 27367 STOPPED  (client disconnected)

我不确定这里出了什么问题。我以前在旧版本的 spring boot 和 gradle 上运行它没有问题。

但是当我这样做时

java -jar -Dspring.profiles.active=dev -Dserver.port=8090 build/libs/demo-0.0.1-SNAPSHOT.jar

我能够在端口 8090 和开发配置文件上运行带有所需参数的应用程序。

【问题讨论】:

标签: gradle spring-boot


【解决方案1】:

尝试使用:

java -Dspring.profiles.active=dev -Dserver.port=8090 -jar build/libs/demo-0.0.1-SNAPSHOT.jar

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-05-10
    • 2020-08-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多