@Entity
@Table (name= "T_book")//table name name is not necessarily useful
public class Book {
@Id//Id of the table
@GeneratedValue//Self-increment property
Private Integer ID;
@Column (length=100)//string Auto-corresponding string
private String name;
@Column (LENGTH=50)
Private String author;
The corresponding table is generated according to the comments
But I got a bug in the process of generating the tag because I didn't follow the spec.
Must be the same as the Startup Class (Xxxxapplication) package name to be scanned
Pom.xml introduction of database-driven and JPA-dependent
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
This article is from the "11854647" blog, please be sure to keep this source http://11864647.blog.51cto.com/11854647/1965819
Springboot automatically generate database tables