0

我已经多次看到这个主题的变体,但答案从未解决我的问题:我一直在将 H2 控制台添加到我的 WebFlux 应用程序(Spring Boot 2.6.3)并且可以连接到它;但在我的 JDBC 架构中看不到我的任何表。事情是......我的控制器工作正常,我可以从我的端点检索我在 shema.sql 和 data.sql 中设置的预期结构和数据

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-r2dbc</artifactId>
    </dependency>
    <dependency>
        <groupId>io.r2dbc</groupId>
        <artifactId>r2dbc-h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>me.yaman.can</groupId>
        <artifactId>spring-boot-webflux-h2-console</artifactId>
        <version>0.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-webflux</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>

这些是我的属性:我正在连接到 localhost:8080/h2-console 并被重定向到 localhost:8081/ 好吧

spring.datasource.url=jdbc:h2:mem:pocdb;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
spring.datasource.username=sa
spring.datasource.password=foobar
spring.datasource.driverClassName=org.h2.Driver
spring.h2.console.enabled=true
spring.h2.console.port=8081
spring.h2.console.path=/h2-console

正如我所说,与控制台的连接正常,在登录 URL 中声明了我的“pocdb”模式;但我在这里看不到任何自定义表格:-(

我也尝试了使用和不使用 db url 参数,但没有任何变化。如果有人对我做错了什么有任何线索,我会在这里松一口气。谢谢

4

0 回答 0