Bean Scope in Spring

Overview When defining a <bean> you have the option of declaring scope for that bean In this blog we will cover What are different types of Scope available in Spring.. Example for each scope type Types of Scope Scope Description singleton Scopes a single bean definition to a single object instance per Spring IoC container. prototype Scopes a single bean definition to any number of object instances. request Scopes a single bean definition to the Read more…

Dependency Injection in Spring without XML

Overview In previous blog, we saw Dependency Injection in Spring using Annotation. Here we will see how we can do the same using Annotation but without defining Autoscan in XML. We will make use of @Configuration and @Bean to define configuration the same as we did for XML in above case. Configuration Class Car Class Main Class Explanation Annotating a class with the @Configuration indicates that the class can be used by the Spring IoC Read more…

Dependency Injection in Spring using Annotation

Overview In previous blog we saw Dependency Injection in Spring using XML. Here we will see how we can do same using Annotation Construction Injection using Annotation xml file Paint class Car class Main class Explanation In xml we are telling Spring to look for a package to scan for Annotation based configurations like in this case @Component and @Autowired . @Autowired above Car is way of injecting Bean as a Constructor Setter Injection using Read more…

Dependency Injection in Spring using XML

Overview In my previous blog we saw an overview of Spring IoC and DI. Here we will see Dependency Injection (DI) in detail by answering following question: What is DI Ways of injecting Dependency using XML Dependency Injection Dependency Injection (DI) is a design pattern that removes the dependency from the programming code so that it can be easy to manage and test the application. Dependency Injection makes our programming code loosely coupled. Ways of Read more…

Inversion of Control and Dependency Injection with Spring – Overview

Overview In this blog, we will cover following points What is IoC Spring IoC Container Dependency Injection in Spring Example Code Inversion of Control(IoC) Inversion of Control is a principle in software engineering by which the control of objects or portions of a program is transferred to a container or framework. Inversion of Control can be achieved through various mechanisms such as: Strategy design pattern, Service Locator pattern, Factory pattern, and Dependency Injection (DI). Spring Read more…

Spring – An Overview

Overview Spring is a framework for dependency-injection which is a pattern that allows to build very decoupled systems. The Spring Framework is divided into modules. Applications can choose which modules they need. At the heart are the modules of the core container, including a configuration model and a dependency injection mechanism. Official Website Spring Release Spring 1     : 2004 Spring 2     : 2006 Spring 3     : 2009 Spring 4     : 2013 Read more…

Reflection in Java

Overview In this blog, we will cover the following points What is Reflection API? Using private methods Using private fields Sample Code Reflection API Reflection allows instantiation of new objects, invocation of methods, and get/set operations on class variables dynamically at run time without having prior knowledge of its implementation. Real-World Example: Take for example your typical web.xml file. This will contain a list of servlet elements, which contain nested servlet-class elements. The servlet container Read more…

JAX-RS Specification and Implementation provider

Overview In this blog, we will cover What is JAX-RS JAX-RS Specification Implementation provider for JAX-RS Why follow JAX-RS What is JAX-RS JAX-RS: Java API for RESTful Web Services (JAX-RS) is a Java programming language API spec that provides support in creating web services according to the Representational State Transfer (REST) architectural pattern. JAX-RS 2.0 was released in May 2013. JAX-RS 2.1 was released in Sep 2017. JAX-RS Specification JAX-RS provides some annotations to aid in mapping Read more…

JVM, JDK, and JRE

Overview In this blog, we will cover the following points What is JVM, JRE & JDK Steps to run a java file JVM (Java Virtual machine) JVM is responsible for converting Byte code to the machine-specific code. JVM is also platform-dependent and provides core java functions like memory management, garbage collection, security, etc. JRE (Java Runtime Environment) Java Runtime Environment is the implementation of JVM, it provides platform to execute java programs. JRE consists of Read more…

Configure Git for Pull and Push

Overview In this Blog, we will see how to configure and use Git to Pull and Push Data. Assumption:  Git is already installed in your Machine. If not, you can refer to Install Git on Linux, Mac or Windows Download Project from Git Repository (Github/Bitbucket) There are 2 ways to use Git => SSH/HTTPS SSH You need to add your SSH key to Github or Bitbucket Account. In order to Pull/Push repository. Your key will be Read more…