Spring boot 配置H2和x27;带Spring引导的web控制台

Spring boot 配置H2和x27;带Spring引导的web控制台,spring-boot,console,h2,Spring Boot,Console,H2,我似乎不知道如何用SpringBoot配置H2的web控制台。我补充说 spring.datasource.url=jdbc:h2:mem:myschema; spring.h2.console.enabled=true spring.h2.console.path=/console 到我的application.properties,但在localhost:8080/console中仍然没有任何内容。H2的驱动程序是我的类路径,所以我想在中列出的三个条件中,我可能无法满足的唯一条件是 您正在

我似乎不知道如何用SpringBoot配置H2的web控制台。我补充说

spring.datasource.url=jdbc:h2:mem:myschema;
spring.h2.console.enabled=true
spring.h2.console.path=/console
到我的application.properties,但在localhost:8080/console中仍然没有任何内容。H2的驱动程序是我的类路径,所以我想在中列出的三个条件中,我可能无法满足的唯一条件是

您正在开发一个web应用程序

这到底是什么意思?我的pom.xml中有
springbootstarterweb
作为依赖项,我的start/main用

@EnableAutoConfiguration
@ComponentScan({"com.xxxx"})
我错过了什么


请注意,我不想使用MVC。

H2 webconsole自动配置仅在包含SpringWeb时触发

但启动h2 webconsole所需要做的就是运行以下代码

org.h2.tools.Server s = org.h2.tools.Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8080").start();
...
s.stop(); // if you want to stop
您还可以在某处定义这个bean

 @Bean(initMethod="start",destroyMethod="stop")
 public org.h2.tools.Server h2WebConsonleServer () throws SQLException {
   return org.h2.tools.Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8080");
 }

H2 webconsole自动配置仅在包含SpringWeb时触发

但启动h2 webconsole所需要做的就是运行以下代码

org.h2.tools.Server s = org.h2.tools.Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8080").start();
...
s.stop(); // if you want to stop
您还可以在某处定义这个bean

 @Bean(initMethod="start",destroyMethod="stop")
 public org.h2.tools.Server h2WebConsonleServer () throws SQLException {
   return org.h2.tools.Server.createWebServer("-web","-webAllowOthers","-webDaemon","-webPort", "8080");
 }

这很奇怪。甚至我的pom中也有相同的东西(springboot、父项、SpringBootStarterWeb、h2依赖项)。和/或控制台工作得非常好。这是我的h2 dependency com.h2数据库h2运行时,这很奇怪。甚至我的pom中也有相同的东西(springboot、父项、SpringBootStarterWeb、h2依赖项)。和/或控制台工作得非常好。这是我的h2依赖项com.h2数据库h2运行时