spring

Ultimate Spring Boot Interview Preparation Guide

Ultimate Spring Boot Interview Preparation Guide

1. Why Spring Boot? Spring based applications have a lot of configuration. When we use Spring MVC, we need to configure ComponentScan, DispatcherServlet, a view resolver, web jars, and more. Spring Boot is a project that is built on the top of the Spring framework. It provides a simpler and faster way to set up, configure, and run both simple and web-based applications. World is moving towards microservices and cloud-native applications. Spring Boot is the best choice for building microservices. **** ### 2. What are Spring Boot goals? Quick start to Spring. Provide opinionated 'starter' dependencies to simplify build configuration.…
Read More
Understanding @Primary in Spring

Understanding @Primary in Spring

If you read my post about the @Qualifier annotation, you have noticed that defining two beans of the same type can be a challenge. By distinguishing it with a qualifier name, @Qualifier helps Spring determine which bean to inject. The @Primary annotation will help Spring decide which of those same types of beans it should pick primarily. For the bean annotated with the @Primary annotation, the @Qualifier will not be necessary. It is only required for the other bean. Example 1: Using @primary and @Qualifier in Spring Let’s see the example in practice: public interface GreetingService { String greet(); }…
Read More
3 Ways to Use the @Lazy Annotation in Spring

3 Ways to Use the @Lazy Annotation in Spring

Does your Spring application take too long to start? Maybe this annotation could help you. This annotation indicates to Spring that a bean needs to be lazily initiated. Spring will not create this bean at the start of the application. Instead, it will create it only when the bean is requested for the first time. This allows Spring start-up to be faster. However, the first interaction with the bean can be slow because of the time required to create and inject the bean at runtime. You can use this annotation directly in the bean class (beans annotated with @Component and…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.