springboot 中 pom文件相关的依赖+声明

本文全面列举了Spring Boot中常见的依赖启动器,包括核心启动器、数据处理、Web开发、安全、测试等多个方面,为开发者提供了丰富的资源,便于快速构建和管理Spring Boot项目。

在编写代码的时候,在pom文件内添加更改等都是常有的事,但是有时候把,不是所有的依赖都是知道的,所以,我把日常中遇到的依赖都备注下来了,方便自己的同时,也方便大家伙,哈哈。(后续遇到不存在的,会陆续更新,包括spring以外的也会存在,毕竟java高手还是很多的,我们就怀着一颗感恩的心,用他们的成果把~)

spring-boot-starter
这是Spring Boot的核心启动器,包含了自动配置、日志和YAML

spring-boot-starter-amqp
通过spring-rabbit来支持AMQP协议(Advanced Message Queuing Protocol 

spring-boot-starter-aop
支持面向方面的编程即AOP,包括spring-aop和AspectJ

spring-boot-starter-artemis
通过Apache Artemis支持JMS的API(Java Message Service API. 

spring-boot-starter-batch
支持Spring Batch,包括HSQLDB数据库

spring-boot-starter-cache
支持Spring的Cache抽象

spring-boot-starter-cloud-connectors
支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上连接服务

spring-boot-starter-data-elasticsearch
支持ElasticSearch搜索和分析引擎,包括spring-data-elasticsearch

spring-boot-starter-data-gemfire
支持GemFire分布式数据存储,包括spring-data-gemfire

spring-boot-starter-data-jpa
支持JPA(Java Persistence API. ,包括spring-data-jpa、spring-orm、Hibernate

spring-boot-starter-data-mongodb
支持MongoDB数据,包括spring-data-mongodb

spring-boot-starter-data-rest
通过spring-data-rest-webmvc,支持通过REST暴露Spring Data数据仓库

spring-boot-starter-data-solr
支持Apache Solr搜索平台,包括spring-data-solr

spring-boot-starter-freemarker
支持FreeMarker模板引擎

spring-boot-starter-groovy-templates
支持Groovy模板引擎

spring-boot-starter-hateoas
通过spring-hateoas支持基于HATEOAS的RESTful Web服务

spring-boot-starter-hornetq
通过HornetQ支持JMS

spring-boot-starter-integration
支持通用的spring-integration模块

spring-boot-starter-jdbc
支持JDBC数据库

spring-boot-starter-jersey
支持Jersey RESTful Web服务框架

spring-boot-starter-jta-atomikos
通过Atomikos支持JTA分布式事务处理

spring-boot-starter-jta-bitronix
通过Bitronix支持JTA分布式事务处理

spring-boot-starter-mail
支持javax.mail模块

spring-boot-starter-mobile
支持spring-mobile

spring-boot-starter-mustache
支持Mustache模板引擎

spring-boot-starter-redis
支持Redis键值存储数据库,包括spring-redis

spring-boot-starter-security
支持spring-security

spring-boot-starter-social-facebook
支持spring-social-facebook

spring-boot-starter-social-linkedin
支持pring-social-linkedin

spring-boot-starter-social-twitter
支持pring-social-twitter

spring-boot-starter-test
支持常规的测试依赖,包括JUnit、Hamcrest、Mockito以及spring-test模块

spring-boot-starter-thymeleaf
支持Thymeleaf模板引擎,包括与Spring的集成

spring-boot-starter-velocity
支持Velocity模板引擎

spring-boot-starter-web
S支持全栈式Web开发,包括Tomcat和spring-webmvc

spring-boot-starter-websocket
支持WebSocket开发

spring-boot-starter-ws
支持Spring Web Services
Spring Boot应用启动器面向生产环境的还有2种,具体如下:

spring-boot-starter-actuator
增加了面向产品上线相关的功能,比如测量和监控

spring-boot-starter-remote-shell
增加了远程ssh shell的支持

spring-boot-starter-jetty
Spring Boot应用启动器还有一些替换技术的启动器,引入了Jetty HTTP引擎(用于替换Tomcat)

spring-boot-starter-log4j
支持Log4J日志框架。

spring-boot-starter-logging
引入了Spring Boot默认的日志框架Logback。

spring-boot-starter-tomcat
引入了Spring Boot默认的HTTP引擎Tomcat。

spring-boot-starter-undertow
引入了Undertow HTTP引擎(用于替换Tomcat.

spring-boot-starter-validation
做校验

spring-boot-configuration-processor
代替传统的xml或properties配置


 

### Spring Boot POM 文件必要依赖配置示例 对于一个典型的 Spring Boot 应用程序,`pom.xml` 文件中的基本依赖配置通常包括以下几个部分: #### 1. 父项目声明 为了简化依赖管理和版本控制,建议使用 `spring-boot-starter-parent` 作为父项目。 ```xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.7.5</version> <relativePath/> <!-- lookup parent from repository --> </parent> ``` #### 2. 基础依赖设置 引入一些常用的 Starter 来快速启动应用的不同功能模块。以下是几个常见的基础依赖项: - **Web 支持** ```xml <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> </dependencies> ``` - **JPA 和数据库连接** 当涉及到数据持久化时,可以加入 JPA 及相应的数据库驱动支持: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> <!-- MySQL Driver Example --> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> ``` - **安全框架集成 (可选)** 如果需要实现身份验证和授权机制,则应考虑添加 Security 组件: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> ``` - **开发工具包** 方便开发者调试与测试的应用内嵌插件集合: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> <optional>true</optional> </dependency> ``` - **单元测试库** 用于编写自动化测试案例的支持类库: ```xml <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> ``` #### 3. 加密解密扩展 - jasypt-spring-boot 为了让应用程序能够更安全地管理敏感信息,在某些情况下可能还需要额外的安全措施,例如通过加密方式保护配置文件内的密码或其他私有数据。此时可以通过引入第三方库如 Jasypt 实现此目的[^1]。 ```xml <dependency> <groupId>com.github.ulisesbocchio</groupId> <artifactId>jasypt-spring-boot-starter</artifactId> <version>3.0.5</version> </dependency> ``` 以上就是构建一个标准的 Spring Boot 工程所需的核心依赖列表及其对应的 XML 描述片段。当然实际项目可能会根据具体需求有所不同,但上述内容已经涵盖了大部分场景下的常用组件。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值