【发布时间】:2020-08-06 20:28:22
【问题描述】:
我需要将多个参数传递给 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
好像参数解析不正确
【问题讨论】:
标签: java spring-boot maven command-line arguments