"grab" Dependency Deduction



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

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

Advertisements