What settings are required to make spring boot generate tables automatically? [closed]

0

I'm currently trying to set up my application with spring-boot to generate tables automatically but I still do not know how, can anyone help?

    
asked by anonymous 14.05.2017 / 19:12

1 answer

1

You should create the application.properties file and set up your database on it. Example:

spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.url=jdbc\:mysql\://localhost/meu-banco
spring.jpa.hibernate.ddl-auto=update

When the spring.jpa.hibernate.ddl-auto parameter is set to update , when launching the application, Hibernate will check if the tables have already been created, if they have not yet been created, will create them automatically.

Another detail is that to create tables, their entities should be annotated with @Entity

    
21.05.2017 / 22:32