SpringBoot项目常用的Guava依赖
时间: 2023-11-19 07:17:39 浏览: 50
在 SpringBoot 项目中,Guava 是一个非常常用的依赖。以下是一些常见的 Guava 依赖:
1. guava:Guava 核心库,包含了 Guava 的基本功能,如集合、缓存、并发、字符串处理等工具类。
2. guava-jdk8:Guava 针对 JDK8 的扩展库,包含了一些 Java 8 新增的 API 的实现,如 Optional、Streams、FunctionalInterfaces 等。
3. guava-testlib:Guava 的测试库,包含了 Guava 的测试框架和一些测试工具类,如 Truth、Mockito、JUnit4 等。
4. guava-retrying:Guava 的重试库,提供了一些重试机制的实现,如 Retryer、StopStrategies、WaitStrategies 等。
5. guava-graph:Guava 的图算法库,提供了一些图算法的实现,如 Graph、ValueGraph、Network 等。
6. guava-cache:Guava 的缓存库,提供了一些缓存的实现,如 Cache、LoadingCache、CacheBuilder 等。
7. guava-xml:Guava 的 XML 库,提供了一些 XML 解析和生成的工具类,如 XmlEscapers、XmlReader、XmlWriter 等。
总之,Guava 是一个非常实用的工具库,在 SpringBoot 项目中广泛应用。
相关问题
springboot项目常用依赖
一些常用的SpringBoot项目依赖是:
1. spring-boot-starter-web:用于构建Web应用程序的依赖。
2. spring-boot-starter-data-jpa:用于访问数据库的依赖。
3. spring-boot-starter-security:用于项目安全的依赖。
4. spring-boot-starter-test:用于测试的依赖。
5. spring-boot-starter-actuator:用于项目运行状态监测的依赖。
6. spring-boot-starter-log4j2:用于项目日志的依赖。
7. spring-boot-starter-thymeleaf:用于构建基于HTML的应用程序的依赖。
8. spring-boot-starter-cache:用于缓存数据的依赖。
9. spring-boot-starter-mail:用于发送电子邮件的依赖。
10. spring-boot-starter-integration:用于实现系统间集成的依赖。
SpringBoot项目添加mysql依赖
在SpringBoot项目中添加mysql依赖,需要在pom.xml文件中添加以下代码:
```xml
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
```
其中,`${mysql.version}`指的是mysql-connector-java的版本号,可以根据需要进行更改。
添加完依赖之后,需要在application.properties文件中配置数据库连接信息,例如:
```
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
```
其中,`spring.datasource.url`是数据库的连接地址,`spring.datasource.username`和`spring.datasource.password`分别是数据库的用户名和密码,`spring.datasource.driver-class-name`是mysql驱动的全限定类名。根据自己的实际情况进行配置。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)