当前位置: 首页 > 知识库问答 >
问题:

Spring Boot H2数据库-表不显示

仉昂熙
2023-03-14
    dependencies {
    compile('org.springframework.boot:spring-boot-starter-data-rest')
    compile('org.springframework.boot:spring-boot-starter-jdbc')
    compile('org.springframework.boot:spring-boot-starter-data-jpa')
    compile('org.springframework.boot:spring-boot-starter-security')
    compile('commons-io:commons-io:2.5')    
    compile('org.springframework.security:spring-security-jwt:1.0.7.RELEASE')
    compile('org.springframework.security.oauth:spring-security-oauth2:2.2.1.RELEASE')
    // compile 'com.microsoft.sqlserver:mssql-jdbc:6.2.2.jre8'   
    runtime('org.springframework.boot:spring-boot-devtools')
    compile ('org.apache.httpcomponents:httpclient:4.5.5')
    testCompile('com.h2database:h2:1.4.196')
    testCompile('org.springframework.boot:spring-boot-starter-test')
    testCompile('org.springframework.security:spring-security-test')    

}

示例类:

@Entity
@Table(name="auth_user")
public class OAuthUser {

//    @Autowired 
//    @Transient
//    private PasswordEncoder passwordEncoder;
//    
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(name= "username")
    private String userName;

    @Column(name="password")
    @JsonIgnore
    private String password;

    @Column(name="first_name")
    private String firstName;

    @Column(name="last_name")
    private String lastName;

    @Column(name="email")
    private String email;

    @Column(name="is_enabled")
    private boolean isEnabled;

     /**
      * Reference: https://github.com/nydiarra/springboot-jwt/blob/master/src/main/java/com/nouhoun/springboot/jwt/integration/domain/User.java
     * Roles are being eagerly loaded here because
     * they are a fairly small collection of items for this example.
     */
    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "user_role", joinColumns
            = @JoinColumn(name = "user_id",
            referencedColumnName = "id"),
            inverseJoinColumns = @JoinColumn(name = "role_id",
                    referencedColumnName = "id"))
private List<Role> roles;


    public OAuthUser() {};
    public OAuthUser(String firstName, String lastName, String user, String pass) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.userName = user;
        this.password = pass;
    }

/// Getters and Setters omitted

属性(源):

spring.h2.console.enabled=true

spring.h2.console.path=/h2

spring.datasource.url=jdbc:h2:file:~/test

spring.datasource.username=sa

spring.datasource.password=

spring.datasource.driver-class-name=org.h2.Driver

但是,每当我访问http://localhost:8090/h2并单击Connect时,就会直接指向一个空白的白色页面。当我使用“测试连接”按钮时,它说“测试成功”。正如本问题中提到的,我尝试了JDBC:h2:mem:testdb和JDBC:h2:~/test来获取JDBC URL。

IDE控制台中不会显示错误。问题可能是什么?谢了。

暂时还没有答案

 类似资料:
  • 应用程序运行良好...只是数据没有出现...我已经添加了sha用户电子邮件显示在登录后,在登录活动中我已经添加了 但是在实时数据库数据不显示以防万一…我也等了半个小时,尝试了所有的东西…网络也不错。数据库中的数据库规则的数据库图片 mainActivity.java//不能用于单个子级,即firebaseDatabase.getInstance().getReference().child(“aj

  • 下面是FXML代码- 我尝试与数据库连接,并尝试将数据从数据库显示到TableView。我尝试将这些东西实现到控制器类中,如下所示- 问题是,它显示行错误。我不知道这个错误的原因。如果我将一行编辑为,则不会显示行的任何错误。然后应用程序运行良好。但是,当我单击Show TableWiew按钮时,它不会将数据显示到TableView中,而是将数据显示到控制台中。 我应该忽略这些错误吗?我如何解决我的

  • 我试图分配用户作为版主到论坛类别(subreddits)中的透视表称为 这是桌子 版主:id、用户id、子Reddit id、创建时间、更新时间 用户: id: name: email... 子域名:id,用户id,名称。。。 我已经创建了视图,控制器和模型,但数据不会提交到数据库,我没有错误。 注意:我需要访问此路径,以便进入视图并开始提交。 编辑:我刚刚清空了函数,并将其替换为

  • 数据库显示 show databases; mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | app_blogcurder | | auth_demo | | canzhieps

  • 我正在尝试使用MPAndroid图表来显示2组数据。没有语法错误或崩溃,但没有显示任何数据。这是我的代码。 每次我运行时页面都会崩溃。日志显示,“一个或多个DataSet Entry数组比此ChartData对象的x值数组长。”我记录了我的x轴值并检查了,两个数组的大小都是一样的!

  • 我想创建网站。我已经配置了登录“/login”和注册“/registration”页面。这个网站的主要任务是显示每个学生的时间表。现在我需要在页面“/Schedule”上显示科目列表,使用HTML-table,根据学生注册时选择的字段组和课程。我有14个不同的表格和科目列表(一个表格-一组学生)。 是否需要为每个表创建@Entity类和存储库? 如何使用注册数据显示学生信息? 页面“/计划”的控制