【问题标题】:i got Whitelabel Error Page error when i hit http://localhost:8080/h2-console url in springboot project当我在 springboot 项目中点击 http://localhost:8080/h2-console url 时出现 Whitelabel Error Page 错误
【发布时间】:2022-01-21 17:14:33
【问题描述】:
this is my application.properties file in src/main/resource


spring.datasource.platform=h2
spring.h2.console.enabled=true  
spring.datasource.url=jdbc:h2:mem:testdb

我在 pom.xml 中添加了 h2 依赖

<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

另外一个是Jpa依赖和web依赖

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

整个项目在邮递员中运行良好,但当我在网络浏览器中点击 url 时无法运行

【问题讨论】:

  • 你能添加两个调用的日志输出吗?可以添加所有注解的端点资源代码吗?
  • 点击 url @HaimRaman 后控制台中没有显示日志
  • 在应用程序属性更改日志中调试 org.springframework.web=DEBUG ,分享邮递员标头
  • 点击 url 后“出现意外错误(type=Not Found,status=404)。”这显示在 browser@HaimRaman
  • 我正在使用localhost:8080/h2-console url @HaimRaman

标签: java spring-boot postman h2


【解决方案1】:

我怀疑这是配置问题。 将以下内容添加到您的 application.properties

# Enabling H2 Console
spring.h2.console.enabled=true

# Custom H2 Console URL
spring.h2.console.path=/h2-console

我会建议以下文章 https://howtodoinjava.com/spring-boot2/h2-database-example/

【讨论】:

猜你喜欢
  • 2021-11-12
  • 1970-01-01
  • 2019-03-27
  • 2019-02-04
  • 1970-01-01
  • 2020-01-26
  • 2019-03-20
  • 1970-01-01
  • 2019-09-10
相关资源
最近更新 更多