Spring boot 我无法在h2数据库中创建表

Spring boot 我无法在h2数据库中创建表,spring-boot,Spring Boot,我在做一个图书馆管理的小项目。因此,我从这个简单的事情开始,添加细节并获取它们。当我使用h2数据库时,我不会创建表。这是我的密码。有人能修一下吗 import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Table(name ="library") @Entity pub

我在做一个图书馆管理的小项目。因此,我从这个简单的事情开始,添加细节并获取它们。当我使用h2数据库时,我不会创建表。这是我的密码。有人能修一下吗

import javax.persistence.Entity;           
import javax.persistence.Id;        
import javax.persistence.Table;           
@Table(name ="library")
    @Entity          
    public class Book      {
    @Id
    private int id;      
    private String author;         
    private String title;          

    public int getId()        {    
        return id;         
    }
               public void setId(int id)   {
        this.id = id;        
    }                  
           public String getAuthor()   {          
        return author; 
    }
    public void setAuthor(String author)  {    
        this.author = author;        
    }       
    public String getTitle() {            
        return title;                      
    }        
    public void setTitle(String title) {      
        this.title = title;           
    }      
    @Override
    public String toString() {          
        return "Book [id=" + id + ", author=" + author + ", title=" + title + "]";      
    }

确保您的
应用程序.properties
文件具有以下属性

spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
spring.datasource.url=jdbc:h2:~/dbname

添加更多细节。您正在使用哪个版本的spring boot,并在
application.properties
中显示配置是的,我的application.properties中也有相同的内容。即使我不明白,请参考这个