Below code snippet shows the implementation of save method of JPARepository. So, when we hit the save method of JPARepository, it first checks if the given entity already exists or not by hitting select query and if not exists only then executes insert else it updates the existing record. How do I stop executing select […]
Category: Java
Talks about Java
Character Classes If we browse through java regular expressions, we immediately find a table summarizing regular expression constructs. Yes, that’s what we are going to see here. In below table, the left-hand column specifies the regular expression constructs, while the right-hand column describes the conditions under which each construct will match. Construct Description [abc] a, […]
String Literals The most basic form of pattern matching is form of String matching. The pattern here is nothing but a simple string search we want to perform on the given input string. From here, let’s take String replace method which accepts a regularExpression and replacementString as arguments. Metacharacters These are the special characters that […]
What is Java Regular Expressions? From Oracle, it says “Regular expressions are a way to describe a set of strings based on common characteristics shared by each string in the set.” In order to define that common characteristics, we prepare a sequence of characters called ‘Pattern’. These patterns can be used to search, edit, or […]
Let’s look into below example code. The only difference between these blocks is type of iteration. Example 1 uses Iterator and Example 2 uses for each loop. Running either of above example will result in below exception. So, what this exemption conveys us ? We are not allowed to modify the list during iteration. We […]
1. Core Java CopyOnWriteArrayList Reflection API Threading Difference between Process and Thread Different ways to start a thread Thread lifecycle/states Runnable vs Callable Sleep vs Wait Wait vs Join Thread-Safe ExecuterService Difference between class lock and object lock? Best of Java Multithreading Interview Questions Collections Collection vs Collections Hashmap vs ConcurrentHashmap Set which maintains the […]
Let’s practically learn this OAuth2 Authorization Code Grant from below experiment, I want to login into https://www.pinterest.com/ site. Unfortunately I haven’t registered before so i click on signup page. So, i get below page, I can see a regular signup page seeking username, password. But notice that there is two more options. Continue with Facebook […]
Oauth2 is an open standard used to protect resource known as protected resource. Let’s use flight analogy to understand what OAuth2 is, Client – The entity that wants to access the protected resource. Here passenger is the client who wants access a trip from Chennai to Pune. Protected Resource – The flight trip from Chennai […]
I am using JWT in my project for more than 1year but i never realized what actually it is and what it contains. In this post, let ‘see what is this and what it contains. Before we start using JWT, we were using base username and password. A encrypted username and password will be sent […]