Springbootcli 简明教程

"grab" Dependency Deduction

标准 Groovy 代码库包含 @Grab 注解,以便可以声明对第三方库的依赖关系。通过使用 @Grab 注解,Grape Dependency Manager 以类似于 Maven/Gradle 的方式下载 jar,无需任何构建工具。Spring Boot 尝试根据代码推断所需的库。例如,使用 @RestController 表示需要抓取“Tomcat”和“Spring MVC”库。

Standard Groovy codebase contains a @Grab annotation so that dependencies on third-party libraries can be declared. Using @Grab annotation, Grape Dependency Manager downloads jar in similar fashion as that of Maven/Gradle without any build tool. Spring Boot attempts to deduce the required libraries based on code. For example, use of @RestController tells that "Tomcat" and "Spring MVC" libraries are to be grabbed.

Grab Hints

下表详细说明了 Spring Boot 用于下载第三方库的提示 -

Following table details the hints that Spring Boot uses to download third party libraries −

Sr.No.

Hint & Dependency to Download/Link

1

JdbcTemplate, NamedParameterJdbcTemplate, DataSource JDBC Application

2

@EnableJms JMS Application

3

@EnableCaching Caching abstraction

4

@Test JUnit

5

@EnableRabbit RabbitMQ

6

@EnableReactor Project Reactor

7

extends Specification Spock test

8

@EnableBatchProcessing Spring Batch

9

@MessageEndpoint, @EnableIntegrationPatterns Spring Integration

10

@EnableDeviceResolver Spring Mobile

11

@Controller, @RestController, @EnableWebMvc Spring MVC + Embedded Tomcat

12

@EnableWebSecurity Spring Security

13

@EnableTransactionManagement Spring Transaction Management