创建项目,引入相应的启动器*

 

**2. 创建项目,引入相应的启动器**          

 

<img src="./images/image-20191227142727497.png" alt="image-20191227142727497" style="zoom:67%;" />

 

 

 

**3. 编写与数据库表t_comment和t_article对应的实体类Comment和Article** 

 

```java

      public class Comment {

              private Integer id;

           private String content;

       private String author;

       private Integer aId;

           // 省略属性getXX()和setXX()方法

           // 省略toString()方法

}

```

 

```java

public class Article {

 

    private Integer id;

    private String title;

    private String content;

              // 省略属性getXX()和setXX()方法

          // 省略toString()方法

}

```

 

**4.编写配置文件** 

 

   (1)在application.properties配置文件中进行数据库连接配置 

 

```properties

      # MySQL数据库连接配置

      spring.datasource.url=jdbc:mysql://localhost:3306/springbootdata?serverTimezone=UTC

      spring.datasource.username=root

      spring.datasource.password=root

```

 

 

 ~~~~~~~~~~~~~~~~~~~~~

刚学了拉勾教育的《Java工程师高薪训练营》,看到刚学到的点就回答了。希望拉勾能给我推到想去的公司,目标:字节!!
posted @ 2020-06-05 17:51  西西宝贝  阅读(32)  评论(0)    收藏  举报