私はアプリケーションプロパティファイルで以下の設定を使用しました。でも、まだh2コンソールでテーブルを見ることはできません。H2コンソールからH2データベースに接続する
application.properties
logging.level.org.springframework.web=INFO
spring.datasource.url=jdbc:h2:mem:challenge;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE
spring.datasource.driver-class-name=org.h2.Driver
spring.datasource.schema=classpath:/schema.sql
spring.datasource.data=classpath:/data.sql
spring.h2.console.enabled=true
spring.h2.console.path=/h2
server.port = 8080
私は、ログインしてH2コンソールでJDBC URLの文字列jdbc:h2:mem:challenge;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE
を使用。しかし、私は、以下のいずれかのテーブル
を見ていないです、私のGraddleファイル
buildscript {
ext {
springBootVersion = '1.4.4.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
jar {
baseName = 'challenge'
version = '0.0.1-SNAPSHOT'
}
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile('org.springframework.boot:spring-boot-starter-jdbc')
compile('org.springframework.boot:spring-boot-starter-security')
compile('org.springframework.boot:spring-boot-starter-web')
runtime('org.springframework.boot:spring-boot-devtools')
runtime('com.h2database:h2')
testCompile('org.springframework.boot:spring-boot-starter-test')
}
で次はH2エンジンがコンソールを提供しています
@Configuration
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/h2/*").permitAll();
http.csrf().disable();
http.headers().frameOptions().disable();
}
}
[H2またはHSQLDBインメモリデータベースの表示内容](https://stackoverflow.com/questions/7309359/view-content-of-h2-or-hsqldb-in-memory-database)の可能な複製 –
コメントしてくれてありがとう。しかし、私は他のすべての記事を読んで、誰も私の問題を解決しませんでした。基本的にH2データベースに接続してすべての情報を取得するWebサービスであるSpring起動アプリケーションを開始しました。 Webサービスが情報を表示していますが、H2コンソールにログインしているときにテーブルやデータベースが表示されません – Vinayak
あなたのポーまたはグラブを表示してください –