Home » Java

Java

JUnit 5 and Selenium – Setup the project with Gradle, JUnit 5 and Jupiter Selenium

Selenium is a set of tools and libraries supporting browser automation and it is mainly used for web applications testing. One of the Selenium’s components is a Selenium WebDriver that provides client library, the JSON wire protocol (protocol to communicate with the browser drivers) and browser drivers. One of the main advantages of Selenium WebDriver is that it supported by ...

Read More »

All you need to know about System.gc()

java-interview-questions-answers

In this article, we have attempted to answer the most common questions around System.gc() API call. We hope it may be of help. What is System.gc()? System.gc() is an API provided in java, Android, C# and other popular languages. When invoked it will make its best effort to clear accumulated unreferenced object (i.e. garbage) from memory. Who invokes System.gc()? System.gc() ...

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 »

Scoped Proxy in Spring Framework

spring-interview-questions-answers

Spring framework provides scopes for spring beans. We can control the various dependencies and configuration values that are plugged into spring bean using spring scope. Spring supports the following six scopes. Four of six are available in a web-based application: ScopeDescriptionSingletonIt is the default scope in Spring framework. For each Spring IOC Container, only a single instance of the bean ...

Read More »

Spring Boot: Building a RESTful Web Application

spring-interview-questions-answers

Introduction: REST stands for Representational State Transfer and is an architectural guideline for API design. We assume that you already have a background in building RESTful APIs. In this tutorial, we’ll design a simple Spring Boot RESTful web application, exposing a few REST endpoints. Project Setup: Let’s start by downloading the project template via Spring Initializr: We only need to ...

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 »

Spring Boot with H2 Database

spring-interview-questions-answers

In this quick tutorial, we’ll bootstrap a simple Spring Boot application backed by an in-memory H2 database. We’ll use the Spring Data JPA to interact with our database. Project Setup: Firstly, let’s generate our project template using Spring Initializr: On clicking the ‘Generate the project’ link, our project files will get downloaded. Now, if we look closely at the generated ...

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 »