java

Eager vs Lazy Initialization of Spring Beans

Eager vs Lazy Initialization of Spring Beans

In Spring, one of the fundamental concepts revolves around the initialization of beans. When developing applications using the Spring Framework, you have the option to choose between eager and lazy initialization of beans. Both have their unique advantages and trade-offs, and understanding these differences can help you optimize your application’s performance and resource usage. What are Spring Beans? Before diving into eager and lazy initialization, let’s briefly touch on what Spring beans are. In Spring, a bean is simply an object that is instantiated, assembled, and managed by the Spring IoC (Inversion of Control) container. Beans are typically singleton by…
Read More
Securing Microservices with Spring Security: Implementing JWT

Securing Microservices with Spring Security: Implementing JWT

JSON WEB TOKEN (JWT) JWT (JSON Web Token) is a method for securely transmitting information between two parties (such as a client and a server) as a JSON object. It's designed to be compact and URL-safe, making it easy to pass around in URLs, headers. Header Payload Signature HeaderThe header typically consist two parts: the type of the token (JWT) and the signing algorithm being used, such as HMAC SHA256 or RSA. {"alg":"HS256","typ":"JWT"} PayloadThis is where the actual data is stored. It can include information like the user ID, roles, expiration time, and other claims (data about the user or…
Read More
Implementing a Dynamic RBAC System for Enterprise Applications – Simplified

Implementing a Dynamic RBAC System for Enterprise Applications – Simplified

Introduction In today’s digital landscape, effective access management is critical for securing resources and data. A Role-Based Access Control (RBAC) system provides a structured approach to managing user permissions and roles. This blog outlines two variations of RBAC systems tailored to different application needs: Common Business Applications and Enterprise Business Applications. To illustrate the concepts, we’ll provide a demo code snippet for a service managing access control, as well as a detailed description of each table used in the RBAC system. RBAC System Components Common Business Applications For most common business applications, the RBAC system can be streamlined to manage…
Read More
Sintaxe alternativa para a declaração de arrays

Sintaxe alternativa para a declaração de arrays

Sintaxe Alternativa de Declaração de Arrays: Arrays podem ser declarados com os colchetes após o tipo, em vez do nome da variável. Exemplos:int counter[] = new int[3]; é equivalente a int[] counter = new int[3];.char table[][] = new char[3][4]; é equivalente a char[][] table = new char[3][4];. Conveniência na Declaração de Múltiplos Arrays: A sintaxe alternativa é útil para declarar múltiplos arrays do mesmo tipo em uma linha. Exemplo:int[] nums, nums2, nums3; é equivalente a int nums[], nums2[], nums3[];. Retorno de Arrays em Métodos: A sintaxe alternativa é conveniente para especificar que um método retorna um array. Exemplo:int[] someMeth() {…
Read More
Introduction to SOLID Principles in Java Development

Introduction to SOLID Principles in Java Development

In the ever-evolving field of software development, one of the biggest challenges is ensuring that code remains clean, maintainable, and scalable as projects grow. This is where the SOLID principles come into play. Coined by Robert C. Martin, also known as Uncle Bob, and later popularized by Michael Feathers, these five principles provide a solid (pun intended) foundation for writing object-oriented code that stands the test of time. But what exactly are the SOLID principles, and why should you, as a Java developer, care about them? In this post, we’ll explore each of these principles, understand their importance, and see…
Read More
Lets do dates properly

Lets do dates properly

As a beginner one of the most interesting topics you’ll learn are Dates. Even though it might sound a bit boring, it's one of the key things you might know; from your Database, API, GUI, and more learning how to deal with dates properly is a key factor in writing good applications. An important detail you must remember is Java was rushed for the web, thus you have a lot of quirky and somewhat stupid ways to do stuff. The goal of this guide will be to teach you how to use the latest Java APIs to write efficient good…
Read More
How To Fix “java.io.IOException: Problem reading font data.” When Load Customized TTF In Java.

How To Fix “java.io.IOException: Problem reading font data.” When Load Customized TTF In Java.

Yesterday, my colleague said the service had a problem loading the customized font -- NotoSerif-Regular.ttf on our SIT, but it worked on local, the error was as follows: After trying several methods, although it was resolved, I still have many questions. Our containerized service uses the base container image – amazoncorretto:19-alpine. Below is the solution and it seems that the font-noto package must be installed first, or the problem will exist again. However, I can only treat it as a workaround but not a good solution. Because the package I installed contained the TTF file of font covered in the…
Read More
Mastering Fragments in Java for Android Development

Mastering Fragments in Java for Android Development

Fragments are a crucial component in Android development, providing a modular and reusable architecture for creating dynamic user interfaces. A fragment represents a portion of a user interface within an activity, allowing for more flexible and manageable UI designs, especially on larger screens. This article will guide you through the fundamentals of fragments in Java, their lifecycle, and how to implement them in your Android projects. Understanding Fragment Lifecycle: A fragment's lifecycle is closely tied to the lifecycle of its host activity but with additional states. Here are the key stages: onAttach(): Called when the fragment is first attached to…
Read More
java

java

What is Java?Java is a programming language and a platform. Java is a high level, robust, object-oriented and secure programming language. Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Before Java, its name was Oak. Since Oak was already a registered company, so James Gosling and his team changed the name from Oak to Java. Platform: Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and API, it is…
Read More
Persistent and Immutable Java LinkedList

Persistent and Immutable Java LinkedList

In this article we are going to implement a persistent and immutable variation of the LinkedList in Java withpartial structural sharing for time and space efficiency gains. Introduction What is a LinkedList A linked list is a data structure consisting of a collection of nodes where each node contains a value and a reference to the next node in the sequence. Operations like adding an element to head of the list or removing an element from the head are O(1) operations. However, operations like adding an element to the end of the list or removing an element from the end…
Read More
No widgets found. Go to Widget page and add the widget in Offcanvas Sidebar Widget Area.