Posts

Spring Dependency Injection

  What is Inversion of control (IOC )?      πŸ’œWhere control of object is transferred to container or framework.      πŸ’œIOC allows container to take control on flow of program.      πŸ’œTo implement IoC, the dependency injection is used. Spring Container           πŸ’œ  The interface " ApplicationContext " represents the spring container.      πŸ’œ  Spring container instantiate, configuring and assemble spring beans and manage their life cycle. Spring bean      πŸ’œ  An object which is managed by spring container is known as spring bean. What is Dependency in spring framework? public class Invoice {      String name;      Double amount;      List<String> items;      Vendor vendor;      TaxDetails taxDetails; } class Vendor { } interface TaxDetails { }    πŸ’œ Invoice class has various instance variables (name, amount, items, vendor, and taxDetails).    πŸ’œ If we want to create object of Invoice then we need all instan

Spring Annotation

Annotation πŸ‘‰ @SpringBootApplication - Its combination of 3 annotations  @Configuration - Enable java-based configuration, and class annotated with @configuration is used to define spring beans. @ComponentScan - Scan package and sub package for stereotype annotations such as @component @Service, @controller, @Repository. It used to auto detect and register bean in spring application context. @EnableAutoConfiguration - Enable auto configure feature of spring boot which can automatically configure certain spring feature based upon dependency present in class path. We can exclude certain classes from auto configuration using exclude attribute. πŸ‘‰ Stereotype annotations (Spring IOC scan beans and manage lifecycle of beans) @Component - Annotation that allows spring to detect our custom bean automatically. @Service - The business logic of an applicat

Design Patterns

  Design Patterns   πŸ‘‰ Design patterns are solution for solving common object-oriented design problem/task. πŸ‘‰ Design pattern represent idea not particular implementations. πŸ‘‰ Using design pattern code will be more flexible, reusable and maintainable. πŸ‘‰ 3 type of design patterns πŸ’™ Behavioral Design Pattern-                       This pattern is concerned with algorithm and assignment of responsibility between objects. πŸ’™  Creational Design Pattern-                      This pattern provides various object creation mechanism which increase flexibility and reusability of code. πŸ’™  Structural Design Pattern-                      This pattern explains how assemble object and classes into larger structure while keeping this structure flexible and efficient.

Internal Working

 Internal Working of HashMap πŸ‘‰ HashMap works on principle of hashing. πŸ‘‰ We have put(key, value) and get(key) method for storing and retrieving element from hashmap. πŸ’œ  put() method πŸ‘‰ When we pass key and value object to put() method then Hashmap implementation call hashcode method on key object and return hashcode πŸ‘‰ This hashcode pass to the hashing function and return integer as bucket location. πŸ‘‰ Hashing function find bucket location for storing entry object (key value pair) πŸ‘‰ If two different objects have same bucket location then collision occurs, so hashmap use LinkedList to store objects πŸ‘‰ While entry insert in LinkedList - use equals() and hashcode() contract- if key object and entry key object are equals and hashcode is also same then override the value, else put entry object in next node πŸ’œ get() method πŸ‘‰ When call get() then hashmap uses key objects hashcode to find out bucket location which is linked list πŸ‘‰ While traversing LinkedList call keys.equals() method

Java 8 Features

 Java 8 introduced most amazing features to enhanced and improve the language's capabilities. Functional Interface  Lambada Expression Method Reference Stream API Default and Static Methods in interface Optional class forEach() method Date and Time API StringJoiner

Welcome to Java study !!!

Image
" Namaskar and welcome to your blog!" I am going to start publishing blog on Java technologies. I will cover Java, Spring boot, Microservice and many more topics. If you are preparing for interview, then you are in right place. This blog is very useful for beginners to experience level. So, Let's start our journey with Java study to become pro player and show the "SWAG".    YOU ARE ALWAYS WELCOME FOR SUGGESTIONS!!!!