我在我的应用程序属性文件中使用了下面的设置。但仍然无法在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
我使用了字符串jdbc:h2:mem:challenge;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MV_STORE=FALSE
在JDBC URL H2控制台上登录。然而,我没有看到任何表
下面是我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')
}
以下是实现Springsecurity我的春天启动的应用程序
@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) –
感谢您的意见。但我确实阅读了所有其他文章,但他们都没有解决我的问题。我已经启动了我的Spring启动应用程序,它基本上是一个连接到H2数据库并获取所有信息的Web服务。 web服务正在显示信息,但是当我登录到H2控制台时,我没有看到任何表或数据库 – Vinayak
请显示您的pom或gradle –