美文网首页
springboot2.x 如何disable Command

springboot2.x 如何disable Command

作者: 等一夏_81f7 | 来源:发表于2018-11-09 14:53 被阅读0次

    By default, SpringApplication converts any command line option arguments (that is, arguments starting with --, such as --server.port=9000) to a propertyand adds them to the Spring Environment. As mentioned previously, command line properties always take precedence over other property sources.

    If you do not want command line properties to be added to the Environment, you can disable them by using SpringApplication.setAddCommandLineProperties(false).

    解释一下:通过--server.port=9000这种形式传入参数,如果不想设置到环境变量Environment中可以通过以下操作处理:

    SpringApplication.setAddCommandLineProperties(false)

    相关文章

      网友评论

          本文标题:springboot2.x 如何disable Command

          本文链接:https://www.haomeiwen.com/subject/mgkoxqtx.html