如何在命令行中使用spring.config.location选项运行jar文件



我想从命令行运行我的jar文件。如果我使用 Intellij IDEA 运行它 - 一切正常。

/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54124,suspend=y,server=n -Dcom.sun.management.config.file=/Users/admin/Desktop/src/config_local/ngs/ngpd/jmx.properties -Dngpd.conf=/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd/ngpd.properties -javaagent:/Users/admin/Library/Caches/JetBrains/IdeaIC2020.2/captureAgent/debugger-agent.jar -Dfile.encoding=UTF-8 -classpath/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar -jar/Users/admin/IdeaProjects/GameServer-JARs/src/jars/ngs-demo-platform-server-2.19.2.b4.jar —spring.config.location=classpath:/ngpd.yaml,file:/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd.yaml

但是当我尝试在命令行中运行它时,它失败了:

java -Dcom.sun.management.config.file=/Users/admin/Desktop/src/config_local/ngs/ngpd/jmx.properties -Dngpd.conf=/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd.properties -jar/Users/admin/IdeaProjects/GameServer-JARs/src/jars/ngs-demo-platform-server-2.19.2.b4.jar —spring.config.location=classpath:/ngpd.yaml,file:/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd.yaml

我无法正确传递给命令参数 - spring.config.location。 我有错误:

AnnotationConfigEmbeddedWebApplicationContext:551 - 上下文初始化期间遇到异常 - 取消刷新尝试:org.springframework.beans.factory.UnsatisfiedDependencyException:创建在 URL 中定义名称为"gameVerificationMXBean"的 Bean 时出错 [jar:file:/Users/admin/IdeaProjects/GameServer-JARs/src/jars/ngs-demo-platform-server-2.19.2.b4.jar!/BOOT-INF/classes!/ngs/dp/server/jmx/GameVerificationMXBean.class]:表示未满足的依赖关系通过构造函数参数 0;嵌套异常是 org.springframework.beans.factory.BeanCreationException:创建名为"gameVerificationServiceImpl"的 bean 时出错:自动连线依赖项注入失败;嵌套异常是 java.lang.IllegalArgumentException:无法解析值"${demo.gamesVerification.requestTrysCount}"中的占位符"demo.gamesVerification.requestTrysCount">

我做错了什么?谢谢)

我所需要的只是:

java -Dspring.config.location=classpath:/ngpd.yaml,file:/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd.yaml -Dcom.sun.management.config.file=/Users/admin/Desktop/src/config_local/ngs/ngpd/jmx.properties -Dngpd.conf=/Users/admin/Desktop/src/config_local/ngs/ngpd/ngpd.properties -jar/Users/admin/IdeaProjects/GameServer-JARs/src/jars/ngs-demo-platform-server-2.19.2.b4.jar

相关内容

  • 没有找到相关文章

最新更新