Home » Spring » Page 5

Tag Archives: Spring

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 »

Streaming live updates from a reactive Spring Data repository

This post details a naive implementation of streaming updates from a database to any other components that are interested in that data. More precisely, how to alter a Spring Data R2DBC repository to emit events to relevant subscribers. A little bit of background knowledge of R2DBC and Spring will be helpful for this post. My previous writings, Asynchronous RDBMS access ...

Read More »

Monitor Your Java Apps with Spring Boot Actuator

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. Have you worked with Spring Boot Actuator yet? It’s an immensely helpful library that helps you monitor app health and interactions with the app – perfect for going to production! ...

Read More »