小编Raj*_*n P的帖子

在命令行 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)

似乎参数没有正确解析

java command-line arguments maven spring-boot

2
推荐指数
1
解决办法
3252
查看次数

标签 统计

arguments ×1

command-line ×1

java ×1

maven ×1

spring-boot ×1