Spring boot running a fully executable JAR and specify -D properties

后端 未结 2 1967
陌清茗
陌清茗 2020-12-09 10:00

The Spring Boot Maven and Gradle plugins can now generate full executable archives for Linux/Unix operating systems.Running a fully executable JAR is as easy as typing:

2条回答
  •  天涯浪人
    2020-12-09 10:15

    By default SpringApplication will convert any command line option arguments (starting with ‘--’, e.g. --server.port=9000) to a property and add it to the Spring Environment. As mentioned above, command line properties always take precedence over other property sources.

    e.g.

    $ java -jar myapp.jar --spring.application.json='{"foo":"bar"}'
    

    please see http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/

提交回复
热议问题