SpringBoot的创建

第一步:SpringBoot的创建

 第二步:SpringBoot的创建

第三步:SpringBoot的创建 第四步:SpringBoot的创建

 pom文件配置:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.4.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.junit.vintage</groupId>
                <artifactId>junit-vintage-engine</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>3.4.2</version>
    </dependency>
    <!--mysql驱动-->
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
    </dependency>


    <dependency>
        <groupId>cn.hutool</groupId>
        <artifactId>hutool-all</artifactId>
        <version>5.5.4</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-autoconfigure</artifactId>
    </dependency>
    <dependency>
        <groupId>com.github.xiaoymin</groupId>
        <artifactId>knife4j-spring-boot-starter</artifactId>
        <!--在引用时请在maven*仓库搜索3.X最新版本号-->
        <version>3.0.2</version>
    </dependency>
    <dependency>
        <groupId>com.github.xiaoymin</groupId>
        <artifactId>knife4j-springdoc-ui</artifactId>
        <!--在引用时请在maven*仓库搜索3.X最新版本号-->
        <version>3.0.2</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.18.16</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-cache</artifactId>
    </dependency>
</dependencies>

第五步:

SpringBoot的创建

 配置application.yml文件:

server:
#  服务器端口
  port: 8880(随便设置)

spring:
  datasource:
    url: jdbc:mysql://localhost:3306/(数据库名)?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
    username: root(数据库用户)
    password: 123456(数据库密码)
    driver-class-name: com.mysql.cj.jdbc.Driver
  devtools:
    restart:
      poll-interval: 2s
      quiet-period: 1999ms
mybatis:
  #mapper文件
  mapper-locations: classpath:mapper/*.xml
  configuration:
    map-underscore-to-camel-case: true


mybatis-plus:
  configuration:
    #打印SQL语句
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl


swagger:
  enable: true

第六步:SpringBoot的创建

 第七步:测试

SpringBoot的创建

 第八步:验证

SpringBoot的创建

搞定! 

 

上一篇:使用easycode生成代码


下一篇:springboot自定义starter