Home » Spring » Page 7

Tag Archives: Spring

Spring @Primary Annotation

spring-interview-questions-answers

Introduction: Spring @Primary annotation is used to give a higher preference to the marked bean when multiple beans of the same type exist. Spring, by default, auto-wires by type. And so, when Spring attempts to autowire and there are multiple beans of the same type, we’ll get a NoUniqueBeanDefinitionException: Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException   : No qualifying bean of type [com.programmergirl.Person]   is ...

Read More »

Easy Spring Boot Deployment with AWS Elastic Beanstalk

spring-interview-questions-answers

Friends don’t let friends write user auth. Tired of managing your own users? Try Okta’s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes. Nearly all applications rely on authentication. Developers, and the companies that employ them, want to confirm who is making the request and are they who they say they are. And, ...

Read More »

Spring @Lazy Annotation

spring-interview-questions-answers

Introduction: The Spring framework, by default, loads and eagerly initializes all beans at the application startup itself. In our application, we might have some pretty resource-intensive beans. We’ll prefer to load such beans on a need basis. We can achieve this using the Spring @Lazy annotation. In this tutorial, we’ll learn how to use @Lazy annotation to lazily load our ...

Read More »

Spring @Order Annotation

spring-interview-questions-answers

Introduction: The Spring @Order annotation was first introduced in Spring 2.0. It was then used only to define the order among the AspectJ advices. Later in Spring 4.0, the implementation of this annotation was further improved a bit. Since then, it also supports ordering of Spring components or beans in a collection like a Java array or a List. This ...

Read More »

Strategy Pattern Revisited With Spring

spring-interview-questions-answers

This blog post wants to show another approach how to implement the Strategy Pattern with dependency injection. As DI framework, I choose Spring framework Firstly, let’s have a look how the Strategy Pattern is implemented in the classic way.As starting point, we have a HeroController that should add a hero in HeroRepository depends on which repository was chosen by the ...

Read More »

Spring Method Security with PreAuthorize

spring-interview-questions-answers

Friends don’t let friends write user auth. Tired of managing your own users? Try Okta’s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes. This tutorial will explore two ways to configure authentication and authorization in Spring Boot using Spring Security. One method is to create a WebSecurityConfigurerAdapter and use the fluent API to override the ...

Read More »

Unit test for Spring’s WebClient

WebClient to quote its Java documentation is Spring Framework’sNon-blocking, reactive client to perform HTTP requests, exposing a fluent, reactive API over underlying HTTP client libraries such as Reactor Netty. In my current project I have been using WebClient extensively in making service to service calls and have found it to be an awesome API and I love its use of ...

Read More »

Augmenting a Spring Data repository through delegation

I have recently written several posts about Kotlin’s delegation. In doing so, I realised a useful way to apply it to Spring Data repositories. Which would allow Spring Data to continue sprinkling some magic while providing a route for customisation. The code shown in this post is in Kotlin, but is still relevant to Java. This post uses R2DBC, but ...

Read More »

Build Mobile Apps with Angular, Ionic 4, and Spring Boot

spring-interview-questions-answers

Friends don’t let friends write user auth. Tired of managing your own users? Try Okta’s API and Java SDKs today. Authenticate, manage, and secure users in any application within minutes. I’m a big fan of Ionic. I started using it several years ago when it was based on AngularJS. As a developer, I really liked it because I knew Angular. ...

Read More »