Mr.Humorous 🥘

Nothing is impossible, the word itself says 'I'm possible'❗️ 💪

Guide to Java Native Interface

Walk through JNI

1. Introduction As we know, one of the main strengths of Java is its portability – meaning that once we write and compile code, the result of this process is platform-independent bytecode. Simply ...

5 Phases of Java Program

How a Java program is executed

Phase 1: Edit We create the program on editor, after that it stored in the disk with the name’s ending .java Phase 2: Compile javac (java compiler) Compiler translate from high-level language ...

Intro to Spring Security Expressions

Basic usages of Spring Security Expressions

1. Maven Dependencies <dependencies> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-web</artifactId>...

Understanding Spring Redirects

Introduction to Spring Redirects

1. Why Do A Redirect? Let’s first consider the reasons why you may need to do a redirect in a Spring application. There are many possible examples and reasons of course. One simple one might be PO...

Understanding Spring Data REST

Introduction to Spring Data REST

1. Overview In general, Spring Data REST is built on top of the Spring Data project and makes it easy to build hypermedia-driven REST web services that connect to Spring Data repositories – all usi...

Hashcode in Java

The importance of hashcode method and how to override

1. Overview Hashing is a fundamental concept of computer science. The full example code is on Github. In Java, efficient hashing algorithms stand behind some of the most popular collections we hav...

Spring Security Expressions - hasRole Example

Understanding hasRole expression

1. Overview Spring Security provides a large variety of Expressions, using the powerful Spring Expression Language (SpEL). Most of these security expressions are evaluated against a contextual obje...

Spring Security - Authentication with a Database-backend UserDetailsService

Understanding Spring Security Context Propagation

1. Overview The example to create a custom database-backend UserDetailsService for authentication with Spring Security is on Github. 2. UserDetailsService The UserDetailsService interface is used ...

Spring Security - Retrieve User Information

Understanding how to retrieve user information

1. Get the User in a Bean The simplest way to retrieve the currently authenticated principal is via a static call to the SecurityContextHolder: Authentication authentication = SecurityContextHolder...

JUnit - Lifecycle of a Test Class

Understanding JUnit Test Class Lifecycle

Annotation Overview Every time we run a JUnit test class, a new instance of it is created. There is even a new instance before each test method execution. JUnit framework provides following basic l...