A Quick Guide to the Spring @Lazy Annotation 1. Overview By default, Spring creates all singleton beans eagerly at the startup/bootstrapping of the application context. The reason behind this is simple: to avoid and detect all possible errors immediately rather than at runtime. However, there’re cases when we need to… Continue Reading spring-lazy-annotation

Spring’s RequestBody and ResponseBody Annotations 1. Introduction In this quick article, we provide a concise overview of the Spring @RequestBody and @ResponseBody annotations. Further reading: Guide to Spring Handler Mappings The article explains how HandlerMapping implementation resolve URL to a particular Handler. Read more → Quick Guide to Spring Controllers… Continue Reading spring-request-response-body

Guide to @EnableConfigurationProperties 1. Introduction In this quick tutorial, we’ll show how to use an @EnableConfigurationProperties annotation with @ConfigurationProperties annotated classes. 2. Purpose of @EnableConfigurationProperties Annotation @EnableConfigurationProperties annotation is strictly connected to @ConfiguratonProperties. It enables support for @ConfigurationProperties annotated classes in our application. However, it’s worth to point out that… Continue Reading spring-enable-config-properties

Quick Guide to the Spring @Enable Annotations 1. Overview Spring comes with a set of @Enable annotations that make it easier for developers to configure a Spring application. These annotations are used in conjunction with the @Configuration annotation. In this article we will be looking at some these annotations: @EnableWebMvc… Continue Reading spring-enable-annotations

Spring MVC and the @ModelAttribute Annotation 1. Overview One of the most important Spring-MVC annotations is the @ModelAttribute annotation. The @ModelAttribute is an annotation that binds a method parameter or method return value to a named model attribute and then exposes it to a web view. In the following example,… Continue Reading spring-mvc-and-the-modelattribute-annotation

The SpringJUnitConfig and SpringJUnitWebConfig Annotations in Spring 5 1. Introduction In this quick article, we’ll take a look at the new @SpringJUnitConfig and @SpringJUnitWebConfig annotations available in Spring 5. These annotations are a composition of JUnit 5 and Spring 5 annotations that make test creation easier and faster. 2. @SpringJUnitConfig… Continue Reading spring-5-junit-config

A Quick Guide to Spring @Value 1. Overview In this quick article, we’re going to have a look at the @Value Spring annotation. This annotation can be used for injecting values into fields in Spring-managed beans and it can be applied at the field or constructor/method parameter level. Further reading:… Continue Reading spring-value-annotation

@Component vs @Repository and @Service in Spring   1. Introduction In this quick tutorial, we’re going to learn about the differences between @Component, @Repository, @Service annotations, in the Spring Framework. Further reading: Guide to Spring @Autowired A guide to the most commonest usage of Springs @Autowired annotation and qualifiers Read more → The… Continue Reading spring-component-repository-service