2018-08-20

springboot框架搭建:

1、新建项目:


2018-08-20_第1张图片

2、添加新建项目版本控制信息


2018-08-20_第2张图片


2018-08-20_第3张图片

3、选择项目使用的依赖,在idea创建springboot项目中你可以使用使用勾选的方式选择你想要的依赖,idea会在创建项目时自动生成在pom.xml文件中。

一般需要勾选的有mybatis、mysql(oracle)、web,其他的看自己项目还需要哪些依赖就勾选好了。


2018-08-20_第4张图片

4、选择项目路径


2018-08-20_第5张图片

5、编写配置文件

配置文件一般分为两种,一种为yml文件,一种为properties文件。

application.properties 配置文件在写的时候要写完整,如:

spring.profiles.active=dev

spring.datasource.data-username=root

spring.datasource.data-password=root

在yml 文件中配置的话,写法如下:

spring:

profiles:

active: prod

datasource:

driver-class-name: com.mysql.jdbc.Driver

url: jdbc:mysql://127.0.0.1:3306/test

username: root

password: root

在项目的resurose文件创建一个配置文件Application.yml,此是yml为空

你可能感兴趣的:(2018-08-20)