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>
相关推荐
陈橘又青1 天前
100% AI 写的开源项目三周多已获得 800 star 了
人工智能·后端·ai·restful·数据
2501_941148611 天前
C++实时数据处理实战:多线程与异步IO结合高性能代码解析
java·后端·struts
IT_陈寒1 天前
Redis实战:5个高频应用场景下的性能优化技巧,让你的QPS提升50%
前端·人工智能·后端
mzlogin1 天前
借助 Let's Encrypt 节省 SSL 证书费用
后端·devops
虎子_layor1 天前
单机压测从百到三千:一次短链跳转服务的全链路性能优化实战
后端·性能优化
SelectDB1 天前
Apache Doris 中的 Data Trait:性能提速 2 倍的秘密武器
数据库·后端·apache
i***27951 天前
Spring boot 3.3.1 官方文档 中文
java·数据库·spring boot
zhengzizhe1 天前
LangGraph4j LangChain4j JAVA 多Agent编排详解
java·后端
程序员鱼皮1 天前
又被 Cursor 烧了 1 万块,我麻了。。。
前端·后端·ai·程序员·大模型·编程
福大大架构师每日一题1 天前
2025-11-27:为视频标题生成标签。用go语言,给定一个字符串 caption(视频标题),按下面顺序处理并输出一个标签: 1. 将标题中的各个词合并成一
后端