如何使用表单创建mysql数据库。我正在使用spring boot

时间:2015-04-30 11:10:19

标签: mysql spring-mvc spring-boot

我现在正在接受培训,我必须从一个表单创建mysql数据库,我必须在其中输入数据库的名称及其详细信息,所有这些都是在启动时弹出的,

1 个答案:

答案 0 :(得分:0)

第一次需要在pom.xml中添加依赖项

<dependencies>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
  </dependency>
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-data-jpa</artifactId>
  </dependency>
  <dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
  </dependency>
</dependencies>

并在文件src / main / resources / application.properties中添加:

spring.datasource.url = jdbc:mysql://localhost:8889/netgloo_blog
spring.datasource.username = root
spring.datasource.password = root
spring.datasource.driverClassName = com.mysql.jdbc.Driver
spring.jpa.database = MYSQL
spring.jpa.hibernate.ddl-auto = update
祝你好运