如何在application.yml中为SpringBoot启用h2控制台?

时间:2018-10-08 08:40:47

标签: spring-boot h2

我有一个application.yml文件,我想在其中启用 h2-console ,但是在Google上搜索时,我只得到了application.properties文件的结果。有人可以帮忙吗?

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:0)

您需要使用此结构

###
#   H2 Settings
###
  h2:
    console:
      enabled: true
      path: /console
      settings:
        trace: false
        web-allow-others: false

答案 2 :(得分:0)

对于属性和yml,请使用以下命令 (application.yml)

spring:
 h2:
    console:
      enabled: true

(application.properties)

   spring.h2.console.enabled = true