小编Vis*_*nde的帖子

H2控制台未显示

我已经阅读了有关H2控制台的几乎所有问题,但没有找到解决方案。当我打URL http:// localhost:8080 / h2-console时,我得到了whitlabel错误页面

我在项目中添加了以下依赖项。:

    <dependencies>
        <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>

            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.h2database/h2 -->
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>>
        </dependency>
    </dependencies>
Run Code Online (Sandbox Code Playgroud)

application.properties

 spring.h2.console.enabled=true
 spring.datasource.url=jdbc:h2
 spring.datasource.driverClassName=org.h2.Driver
 spring.datasource.username=sa
 spring.datasource.password=
 spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

java spring h2 spring-boot

1
推荐指数
1
解决办法
78
查看次数

分配布尔值返回布尔值,但分配整数则不会。为什么?

早些时候,我有b=true一个 if 条件,它被视为布尔值。但这同样不适用于整数。因为x=1我收到错误

无法从 int 转换为 boolean。

下面是代码片段。

public class Tester {
    public static void main(String[] args) {
        boolean b = false;
        if (b = true)
            System.out.println("b true");
        else
            System.out.println("b false");

        int x = 0;

        if (x = 1)
            System.out.println("x 1");
        else
            System.out.println("x 0");
    }   
}
Run Code Online (Sandbox Code Playgroud)

java integer boolean

1
推荐指数
1
解决办法
82
查看次数

标签 统计

java ×2

boolean ×1

h2 ×1

integer ×1

spring ×1

spring-boot ×1