> For the complete documentation index, see [llms.txt](https://jack80342.gitbook.io/spring-boot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jack80342.gitbook.io/spring-boot/vii.-spring-boot-cli/64.-using-the-cli/64.1.-running-applications-with-the-cli/64.1.1-deduced-grab-dependencies.md).

# 64.1.1 推断"grab"依赖

标准的Groovy包含一个`@Grab`注解，它允许你声明对第三方库的依赖。这项有用的技术允许Groovy以和Maven或Gradle相同的方式下载jars，但不需要使用构建工具。

Spring Boot进一步延伸了该技术，它会基于你的代码尝试推导你"grab"哪个库。例如，由于`WebApplication`代码上使用了`@RestController`注解。Spring Boot会获取"Tomcat"和"Spring MVC"。

下列条目被用作"grab提示"：

| 条目                                                       | Grabs                 |
| -------------------------------------------------------- | --------------------- |
| `JdbcTemplate`,`NamedParameterJdbcTemplate`,`DataSource` | JDBC应用                |
| `@EnableJms`                                             | JMS应用                 |
| `@EnableCaching`                                         | 缓存抽象                  |
| `@Test`                                                  | JUnit                 |
| `@EnableRabbit`                                          | RabbitMQ              |
| `@EnableReactor`                                         | 项目重构                  |
| extends `Specification`                                  | Spock测试               |
| `@EnableBatchProcessing`                                 | Spring Batch          |
| `@MessageEndpoint`,`@EnableIntegration`                  | Spring集成              |
| `@Controller`,`@RestController`,`@EnableWebMvc`          | Spring MVC + 内嵌Tomcat |
| `@EnableWebSecurity`                                     | Spring Security       |
| `@EnableTransactionManagement`                           | Spring事务管理            |

**注** 想要理解自定义是如何生效的，可以查看Spring Boot CLI源码中的[CompilerAutoConfiguration](https://github.com/spring-projects/spring-boot/tree/v2.0.0.RELEASE/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/CompilerAutoConfiguration.java)子类。
