maven常用依赖

记录一些常用的maven依赖坐标,也可在Maven Repository: Search/Browse/Explore (mvnrepository.com)搜索

一、SSM框架依赖坐标

1、spring框架依赖


<!-- spring 框架依赖
spring-context中包含了:spring-beans、spring-core、spring-aop、spring-expression -->
<dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>5.3.19</version>
</dependency>
<!-- AOP 依赖
spring-aspects包含了aspectjweaver依赖-->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    <version>5.3.13</version>
</dependency>

2、springmvc 依赖

<!--        SpringMvc 依赖-->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>5.3.13</version>
        </dependency>
<!--        servlet 依赖  此依赖在javaweb中也需加入-->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>
<!--  应注意这两个的版本,有时版本不匹配会导致项目无法启动 -->

3、mybatis 框架

<!-- mybatis 框架-->
<dependency>
            <groupId>org.mybatis</groupId>
            <artifactId>mybatis</artifactId>
            <version>3.5.13</version>
</dependency>
<!-- spring 整合 Mybatis依赖-->
<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis-spring</artifactId>
    <version>2.0.6</version>
</dependency>
<!-- spring 数据库资源管理-->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>5.3.13</version>
</dependency>
<!-- mysql 连接驱动-->
<dependency>
    <groupId>com.mysql</groupId>
    <artifactId>mysql-connector-j</artifactId>
    <version>8.0.32</version>
</dependency>
<!-- xml数据源配置依赖-->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-dbcp2</artifactId>
    <version>2.9.0</version> <!-- 使用实际版本号 -->
</dependency>

4、spring security 依赖

<!--用于web项目中的校验,包含了core核心包-->
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-web</artifactId>
    <version>5.5.8</version>
</dependency>
<!--用于配置文件的支持-->
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>5.5.8</version>
</dependency>

二、SpringBoot坐标依赖

  1. springboot父依赖

    <!-- springboot父依赖,2.x.x版本,JDK1.8版本以上即可 -->
    <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-parent</artifactId>
            <version>2.6.3</version>
            <relativePath/>
    </parent>
    
  2. springboot基础依赖

    <!-- 引入springboot基础依赖,默认导入父依赖的版本 -->
    <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter</artifactId>
    </dependency>
    
  3. springboot整合web的依赖

    <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    
  4. springboot整合Mybatis框架

    <!-- springboot整合Mybatis框架 整合后需要配置数据库连接信息后才可使用-->
      <dependency>
          <groupId>org.mybatis.spring.boot</groupId>
          <artifactId>mybatis-spring-boot-starter</artifactId>
          <version>2.2.0</version>
      </dependency>
      <dependency>
          <groupId>mysql</groupId>
          <artifactId>mysql-connector-java</artifactId>
      </dependency>
    
  5. springboot整合Mybatis-Plus

    <dependency>
                <groupId>com.baomidou</groupId>
                <artifactId>mybatis-plus-boot-starter</artifactId>
                <version>3.5.1</version>
    </dependency>
    
  6. springboot整合spring security 框架

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