You are on page 1of 4

@Configuration:

Spring Configuration annotation indicates that the class has @Bean definition methods

@EnableAutoConfiguration:
enables Spring Boot to auto-configure the application context. Therefore, it automatically
creates and registers beans based on both the included jar files in the classpath and the
beans defined by us

@EnableConfigurationProperties
It enables support for @ConfigurationProperties annotated classes in our application.

@ComponentScan:
El uso de Spring @ComponentScan es uno de los más habituales cuando trabajamos con
una aplicación de Spring . Spring se encarga de instanciar todos nuestros objetos y por lo
tanto actua como una super Factoria que construye objetos .

@SpringBootApplication:
Spring Boot @SpringBootApplication annotation is used to mark a configuration class that
declares one or more @Bean methods and also triggers auto-configuration and component
scanning.

@EnableCircuitBreaker:

@EnableHystrixDashboard:
Hystrix Dashboard provides benefits to monitoring the set of metrics on a dashboard. It
displays the health of each circuit-breaker in a very simple way.

@Bean:
In Spring, the objects that form the backbone of your application and that are managed by
the Spring IoC container are called beans. A bean is an object that is instantiated,
assembled, and otherwise managed by a Spring IoC container.

@Slf4j:
The SLF4J or the Simple Logging Facade for Java is an abstraction layer for various Java
logging frameworks, like Log4j 2 or Logback. This allows for plugging different logging
frameworks at deployment time without the need for code changes.
@Service:
Se usa para construir una clase de Servicio que habitualmente se conecta a varios
repositorios y agrupa su funcionalidad. Es decir por ejemplo si disponemos de dos
Repositorios uno con Profesores y otro con Alumnos es muy común disponer de una clase
Fachada de tipo ServicioCurso que aglutine la funcionalidad de las dos capas de
Repositorio .

@Autowired:
The Spring framework enables automatic dependency injection. In other words, by declaring
all the bean dependencies in a Spring configuration file, Spring container can autowire
relationships between collaborating beans.

@Async:
Spring's ability to run @Async methods in a background thread pool.

@PropertySource:
Spring @PropertySource annotation is used to provide properties file to Spring Environment.
This annotation is used with @Configuration classes. Spring PropertySource annotation is
repeatable, means you can have multiple PropertySource on a Configuration class.

@EnableSwagger2:
The @EnableSwagger2 annotation is used to enable the Swagger2 for your Spring Boot
application. Next, create Docket Bean to configure Swagger2 for your Spring Boot
application. We need to define the base package to configure REST API(s) for Swagger2.

@Getter:
You can annotate any field with @Getter and/or @Setter, to let lombok generate the default
getter/setter automatically.

@Setter:
You can annotate any field with @Getter and/or @Setter, to let lombok generate the default
getter/setter automatically.

@ControllerAdvice:
@ControllerAdvice is a specialization of the @Component annotation which allows to handle
exceptions across the whole application in one global handling component. It can be viewed
as an interceptor of exceptions thrown by methods annotated with @RequestMapping and
similar.
@ExceptionHandler:
The @ExceptionHandler is an annotation used to handle the specific exceptions and
sending the custom responses to the client. Define a class that extends the
RuntimeException class.

@HystrixCommand

@RestController:
This code uses Spring @RestController annotation, which marks the class as a controller

@RequestMapping:
@RequestMapping is the most common and widely used annotation in Spring MVC. It is
used to map web requests onto specific handler classes and/or handler methods.

@Validated:
The @Valid annotation ensures the validation of the whole object. Importantly, it performs
the validation of the whole object graph.

@PostMapping:
@PostMapping is a composed annotation that acts as a shortcut for
@RequestMapping(method = RequestMethod. POST) . @PostMapping annotated methods
handle the HTTP POST requests matched with given URI expression.

@NotNull:
to say that a field must not be null.

@NotEmpty:
to say that a list field must not empty.

@JsonProperty:
The @JsonProperty annotation is used to map property names with JSON keys during
serialization and deserialization. By default, if you try to serialize a POJO, the generated
JSON will have keys mapped to the fields of the POJO.

@ExtendWith
@WebMvcTest:
@WebMvcTest annotation is used for Spring MVC tests. It disables full auto-configuration
and instead apply only configuration relevant to MVC tests. The WebMvcTest annotation
auto-configure MockMvc instance as well.

@BeforeEach:
@BeforeEach annotation is used to signal that the annotated method should be executed
before each invocation of @Test.

@AfterEach:
@AfterEach annotation is used to signal that the annotated method should be executed after
each @Test @RepeatedTest, @ParameterizedTest, or @TestFactory methods in the
current class.

@Test

@MockBean

You might also like