java依赖大全

一、Spring

1、依赖

①Spring核心依赖

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.2.13.RELEASE</version>
</dependency>

SpringAop

spring-aspects依赖包

作用:spring整合AspectJ框架,提供aop注解(@Aspect、@Pointcut、@Before、@AfterReturning、@Around、@AfterThrowing、@After)

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aspects</artifactId>
    <version>5.2.13.RELEASE</version>
</dependency>

③Spring整合JDBC、Spring事务管理

Spring核心依赖包spring-context

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>5.2.13.RELEASE</version>
</dependency>

mysql-connector-java

作用:引入驱动器Driver(com.mysql.cj.jdbc.Driver)

注意:使用8.0.23版本,不能使用8.0.22版本(有bug)

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.23</version>
</dependency>

spring-jdbc

作用:使用JdbcTemplate操作数据库、事务注解、注解管理

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
    <version>5.2.13.RELEASE</version>
    <scope>test</scope>
</dependency>

二、SpringMVC

①SpringMVC核心依赖

<!--spring-mvc依赖-->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
    <version>5.2.13.RELEASE</version>
</dependency>
<!--mvc底层是servlet,必须添加servlet依赖-->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>4.0.1</version>
    <!--provided(编译时有效,打包时不会打包在war包中)-->
    <scope>provided</scope>
</dependency>

②@ResponseBody 注解

<!--当返回类型是对象时,需要使用@ResponseBody 注解,将转换后的 JSON 数据放入到响应体中。-->
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.9.0</version>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.9.0</version>
</dependency>

③文件上传

<!--文件上传-->
<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.1</version>
</dependency>

三、Mybatis

①Mybatis核心依赖

<dependency>
    <groupId>org.mybatis</groupId>
    <artifactId>mybatis</artifactId>
    <version>3.5.6</version>
</dependency>

②log4j

<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

四、SpringBoot

①SpringBoot父工程

作用:提供@Configuration、@Bean注解

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.2.RELEASE</version>
</parent>

②SpringBoot-Web启动器

作用:创建Web工程使用

扫描二维码关注公众号,回复: 16486039 查看本文章
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>

③SpringBoot-Jdbc启动器

作用:SpringBoot整合Jdbc

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

④SpringBoot-test启动器

作用:SpringBoot测试依赖,配合@RunWith(SpringRunner.class)和@SpringBootTest使用

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

⑤SpringBoot-thymeleaf启动器

作用:SpringBoot整合thymeleaf

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

⑥布局框架thymeleaf-layout-dialect

作用:有了这个布局框架,你可以专注于body体的内容,不在纠结与left header footer 公共js css

<dependency>
    <groupId>nz.net.ultraq.thymeleaf</groupId>
    <artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>

⑦mybatis-spring-boot-starter

作用:SpringBoot整合Mybatis,提供@Mapper,@MapperScan注解

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>1.3.2</version>
</dependency>

⑧mapper-spring-boot-starter

作用:SpringBoot整合tk-Mybatis,自动引入mybatis-spring-boot-starter依赖,提供@Table、@Id、@GeneratedValue、@Column、@Transient、@MapperScan注解

<dependency>
    <groupId>tk.mybatis</groupId>
    <artifactId>mapper-spring-boot-starter</artifactId>
    <version>2.0.2</version>
</dependency>

⑨mybatis-plus-boot-starter

作用:SpringBoot整合Mybatis Plus,自动引入mybatis-spring-boot-starter依赖,提供@TableName、@TableId、@TableField注解

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

⑩lombok

作用:简化实体类开发,免写get/set方法和toString方法,提供@Data、@Accessors注解

<dependency>
    <groupId>org.projectlombok</groupId>
    <artifactId>lombok</artifactId>
    <version>1.18.22</version>
    <scope>provided</scope>
</dependency>

文章参考:https://blog.csdn.net/adsfds/article/details/123232694

猜你喜欢

转载自blog.csdn.net/m0_59281987/article/details/129368850