PROFILES IN SPRING using XML

Posted Posted in Uncategorized

There are times when you have to load different sets beans into your application and ignore few sets of beans at the time of starting of your application.For an example consider I am building an app and it’s in under development stage, So I would need to load only beans of my test environment and […]

BEAN INITIALIZATION AND DESTRUCTION IN SPRING

Posted Posted in Uncategorized

Spring container provides options to call methods before bean construction and after bean destruction using which you can do the pre-processing and post-processing tasks.To do that you need to add an attribute init-method=”name of method” to call the method before bean initialization and attribute destroy-method=”name of method” to call the method after bean destruction in your […]

SCOPE OF BEANS IN SPRING FRAMEWORK

Posted Posted in Uncategorized

In Spring every Bean is associated with a scope.When you make a getBean(“bean Id”) call spring container determines which bean to return using the scope of the bean.The default scope of every bean is singleton and there are total 4 types of scope of a bean. Types of scope of a bean: Singleton Prototype request […]

READING PROPERTY FILE IN SPRING FRAMEWORK

Posted Posted in Uncategorized

There will be times when you have to read property file for various reasons like reading database credentials like username, password, connection URL and much more.To do so spring provides a class called PropertySourcesPlaceholderConfigurer, using which you can read a property file content and use it into your application.Let’s implement an application in which we will learn how […]

AUTOWIRING IN SPRING FRAMEWORK

Posted Posted in Spring

Autowiring in spring framework: it’s a feature of spring framework by which spring automatically injects one dependency into the another dependency or in a more formal way we can say implicitly wires the two dependencies.BENEFITS/NON There are 4 modes of Autowiring supported by spring: byName byType constructor no Let’s understand the above description of autowiring […]

INJECTION OF MAP(JAVA COLLECTION) USING SETTER AND CONSTRUCTOR DEPENDENCY INJECTION

Posted Posted in Spring

In our previous tutorial we learned how to inject java collection java.util.Set using spring framework, In this tutorial, we will learn how to inject java collection java.util.Map using Setter and Constructor Injection. Setter Injection using Map values: As we know map contains key-value pair so In setter injection using a Map, we define a tags like below in our […]

INJECTION OF SET (JAVA COLLECTION) USING SETTER AND CONSTRUCTOR DEPENDENCY INJECTION

Posted Posted in Spring

In our previous tutorial we learned how to inject java collection java.util.List using spring framework, In this tutorial, we will learn how to inject java collection java.util.Set using Setter and Constructor Injection. Setter Injection using Set values: In setter injection using a List, we define a tag <property name=”name of variable” > <set> <value>data 1</value> <value>data 2</value> <value>data n</value> </set> […]

INJECTION OF LIST (JAVA COLLECTION) USING SETTER AND CONSTRUCTOR DEPENDENCY INJECTION

Posted Posted in Spring

In our previous tutorial we learned how to inject String, primitives, and objects using spring framework, In this tutorial, we will learn how to inject java collection java.util.List using Setter and Constructor Injection. Setter Injection using List values: In setter injection using a List, we define a tag <property name=”name of variable” > <list> <value>data 1</value> <value>data 2</value> <value>data n</value> […]

Types of Dependency Injection in spring framework

Posted Posted in Uncategorized

Types of Dependency Injection in spring framework: There are basically two types of dependency injection which are – Setter Injection. Constructor Injection. There are generally three types of dependency which we inject: Dependent Object(Class object). String and int, long…etc(primitive types). Collections(List,Set,Map…etc). Here the “types of dependency which we inject” are basically the types of argument […]