SpringBoot+Maven项目的配置构建

文章目录




1、application.properties

也可使用yml yaml

yml 复制代码
#静态资源
spring.mvc.static-path-pattern=/images/**
#上传文件大小设置
spring.http.multipart.max-file-size=10MB
spring.http.multipart.max-request-size=10MB

spring.mvc.pathmatch.matching-strategy=ant_path_matcher

spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/数据库名字
spring.datasource.username=root
spring.datasource.password=root
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

2、pom.xml

主要部分配置

xml 复制代码
 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.5</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>


        <!-- MySQL -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.47</version>
            <scope>runtime</scope>
        </dependency>
<!--       数据库连接池  druid  -->
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>druid-spring-boot-starter</artifactId>
            <version>1.2.20</version>
        </dependency>
<!--        mybatisplus -->

        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.4.2</version>
        </dependency>


<!-- Swagger -->
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>3.0.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-boot-starter</artifactId>
            <version>3.0.0</version>
        </dependency>

    </dependencies>
相关推荐
程序员海军5 分钟前
沪漂五周年了:我越来越迷茫了
前端·人工智能·后端
biubiubiu070612 分钟前
SpringBoot3.5.4 AOP环绕通知使用
java·spring boot
fox_lht16 分钟前
13.3.测试的组织方式
开发语言·后端·rust
西安邮电大学22 分钟前
Redis四大经典缓存问题
java·redis·后端·其他·面试
砍材农夫1 小时前
物联网实战:Spring Boot MQTT | 模拟器Paho客户端拆解核心点
java·javascript·网络·spring boot·后端·物联网
掘金者阿豪1 小时前
用 Codex 的不会还不知道这些开源项目提效吧?
后端
我登哥MVP1 小时前
Spring Boot 从“会用”到“精通”:自动装配原理
java·spring boot·后端·spring·tomcat·maven·intellij-idea
雪隐1 小时前
AI股票小助手05-用 Flask 把 MiniQMT 变成 REST API
人工智能·后端
道友可好2 小时前
Spec Kit:GitHub 官方出品,规范即代码
前端·人工智能·后端
货拉拉技术2 小时前
货拉拉标注平台-拉拉标注
后端·架构