Semaphore can be used to limit the amount of concurrent threads and essentially, this class maintains a set of permits. acquire() takes a permit from the semaphore and release() returns the permit back to the semaphore. In the event of absence of permits, acuire() will block until one is available Semaphore is used to control…
Continue readingUncategorized
Java JDBC CRUD Tutorial
This tutorial will help you understand how to perform basic database operations such as Create, Retrieve, Update and Delete (CRUD) using JDBC, which stands for Java Database Connectivity API. If you have used SQL before, you would be familiar with the INSERT, SELECT, UPDATE and DELETE statements. Effectively, CRUD and ISUD are the same. Before…
Continue readingHow to profile remote java applications
What is profiling? Profiling examines an application and tries to locate memory or performance issues that are associated with a Java application.What it allows you to do is obtaining data about the performance, method timing, object allocation, etc. by monitoring the JVM (Java Virtual Machine). You can use the IDE to profile theses types of…
Continue readingIntroduction to Docker and Docker containers in Java
In short, Docker is a tool that allows you to build, deploy and run applications easily by the usage of so-called containers. These containers let us package all the essentials such as libraries and dependencies. In addition, the containers run on the host operation system. There are many benefits that come when we use Docker. It…
Continue readingDependency Injection in Spring Example
In this tutorial you are going to learn what Dependency Injection in Spring is, how it works and how you can use it. What is Dependency Injection? Dependency Injection is one of the fundamentals of Spring which you must know. When you create a complex application, chances are you are going to have different objects…
Continue readingHow to perform unit testing for Controllers and Services
As you may be well aware, testing is very important. In this tutorial therefore, you will learn how to do just that! Testing. And more specifically, you will learn how to perform that testing on Controllers and Services. Controllers Normal controller does 1 of 2 things: renders a view or handles form submission Let’s look at…
Continue readingCSRF Protection in Spring
In this tutorial you will learn how to protect your application against CSRF. What is CSRF? If you already know what CSRF, feel free to continue without reading this sub-point. But if you don’t, CSRF stands for cross-site request forgery and simply put, it is when attackers make authenticated users to perform an action on the…
Continue readingCore concepts and Advice Types in AOP in Spring
If you are familiar with Spring, you’ve probably heard of Aspect Oriented Programming (AOP). That’s one of the main components of the Spring framework. However, no previous experience in AOP is needed. It is focused for complete beginners who want to understand how AOP framework in Spring works. In Object Oriented Programming, modularity of an…
Continue reading