Raj*_*n P 2 java command-line arguments maven spring-boot
我需要将多个参数传递给 Maven 命令行以运行 Spring Boot 应用程序。这就是我在 Spring Boot 中传递命令行参数的方式。我正在使用 spring boot 2.2.6 Release
mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8999,--spring.application.instance_id=dhn"
但是我收到以下错误
nested exception is org.springframework.boot.context.properties.bind.BindException: Failed to bind properties under 'server.port' to java.lang.Integer
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to bind properties under 'server.port' to java.lang.Integer:
Property: server.port
Value: 8999,--spring.application.instance_id=dhn
Origin: "server.port" from property source "commandLineArgs"
Reason: failed to convert java.lang.String to java.lang.Integer
Action:
Update your application's configuration
Run Code Online (Sandbox Code Playgroud)
似乎参数没有正确解析
, 分隔符似乎不起作用。虽然我已经在教程中看到了这种风格。
有效的是作为分隔符的空间:
mvn spring-boot:run -Dspring-boot.run.arguments="--server.port=8999 --spring.application.instance_id=dhn"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3252 次 |
| 最近记录: |