我已经阅读了有关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)
早些时候,我有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)