Dump Spring boot Configuration

前端 未结 3 518
别那么骄傲
别那么骄傲 2021-01-13 05:56

Our Ops guys want the Spring boot configuration (i.e. all properties) to be dumped to the log file when the app starts. I assume this can be done by injecting the properties

3条回答
  •  星月不相逢
    2021-01-13 06:50

    There is no built-in mechanism and it really depends what you mean by "all properties". Do you want only the actual keys that you wrote or you want all properties (including defaults).

    For the former, you could easily listen for ApplicationEnvironmentPreparedEvent and log the property sources you're interested in. For the latter, /configprops is indeed a much better/complete output.

提交回复
热议问题