Injection of String and Primitive values using Setter and Constructor Injection

Posted Posted in Uncategorized

In our previous tutorial we learned how to inject object using spring framework, In this tutorial, we will learn how to inject String and Primitive values using Setter and Constructor Injection. Setter Injection using String and Primitive values: In setter injection using a String or primitive values, we define a tag <property name=”name of variable” value=”value of […]

Types of Dependency Injection in Spring Framework

Posted Posted in Spring, Spring Core

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 […]

Circus Raju

Posted Posted in Uncategorized

Circus Raju Raju performs various Circus feats in his show. One of them is Magic Bar balancing act (Magic bar, assume it as a long rod). In this feat, he tries to balance the magic bar by placing different weights at equal distances. Balancing point need not be the center of the Bar. He can […]

Profiles in Spring using Annotations

Posted Posted in Uncategorized

In my previous tutorial on Profiles in Spring using XML  we learned about how to do profiling of beans in Spring using XML.Let’s recap the same and implement the same example using Annotations. There are times when you have to load different sets beans into your application and ignore few sets of beans at the time […]

BEAN INITIALIZATION AND DESTRUCTION USING ANNOTATIONS IN SPRING

Posted Posted in Uncategorized

Spring provides options to call methods before bean construction and before destruction.Spring provides “initMethod” and “destroyMethod” attributes which we can apply in @Bean annotation if you have used java based configuration to create beans. And if you have defined your beans outside a Java config class (e.g., with the @Component annotation), then you have to use […]

Read properties file in spring using annotation

Posted Posted in Uncategorized

Spring provides @PropertySource(“path of property file”) annotation and Environment class using which you can easily read the property file. Let’s read the values below property file using this annotation and Environment class and add use those in our spring application and understand how to use as well as where to place these annotations. details.properties basic=basicPhone smart=smartPhone Phone.java […]

Autowiring using annotations in spring

Posted Posted in Uncategorized

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/NO Spring provides @Autowired annotation to achieve autowiring among beans. Let’s understand the above description of autowiring through a simple example by comparing an example of […]