Home » spring beans

Tag Archives: spring beans

Spring Boot Profiles Tutorial

Welcome readers, in this tutorial, we will see how to load profiles (such as DEV, QA, or PROD) in a simple spring boot application. 1. Introduction Before going further in this tutorial we will take a look at the common terminology such as introduction to Spring Boot and Profiles in the spring framework. 1.1 What is Spring boot? Spring boot ...

Read More »

IoC Spring Example

In this post, we feature a comprehensive article about IoC Spring. We will discuss the Inversion of Control and how it is applied in Spring. 1. IoC Spring – Introduction Inversion of Control is an OOP design principle for writing code that is loosely coupled. The objective is to outsource certain responsibilities typically performed by a class to an external ...

Read More »

Spring Bean Life Cycle Example

In this article, we will explain the Spring Bean Life-Cycle. We will learn what Spring Bean is and discuss its life-cycle with an example. Sometimes when the spring beans are created developers need to perform the initialization and the cleanup operations before the bean is destroyed. To achieve this, we can use the InitializingBean and the DisposableBean interfaces in the ...

Read More »

Spring p-namespace Example

Spring framework provides several namespaces to simplify the xml configuration. In spring, developers can use the p-namespace to inject the setter-based dependency and an alternative to using the <property> tag. 1. Introduction Spring is an open-source framework created to address the complexity of an enterprise application development One of the chief advantages of the Spring framework is its layered architecture, ...

Read More »

Spring Prototype Bean Scope Example

In the spring framework, developers can create beans using the in-built spring bean scopes. Out of five in-built scopes, Singleton and Prototype are primary and available in any type of IOC containers. This tutorial will explore the Prototype bean that returns a new bean instance for each and every request. 1. Introduction 1.1 Spring Framework Spring is an open-source framework ...

Read More »

Spring Singleton Bean Scope Example

In the spring framework, developers can create beans using the in-built spring bean scopes. Out of five in-built scopes, Singleton and Prototype are primary and available in any type of IOC containers. This tutorial will explore the Singleton bean that returns a single bean instance per IOC container. 1. Introduction 1.1 Spring Framework Spring is an open-source framework created to ...

Read More »

Spring @Autowired Annotation Example

Spring framework provides autowiring of beans using the XML configuration but the developers decided to go a step ahead and provide the autowiring annotation. This tutorial will explore the Spring-specific annotation (i.e. @Autowired) that will automatically inject the dependent beans. 1. Introduction 1.1 Spring Framework Spring is an open-source framework created to address the complexity of an enterprise application development ...

Read More »

Spring Beans Autowiring Example

One of the most important development principles of the modern software design is the ability to autowire the relationships between the collaborating beans. Spring framework provides a mechanism to implicitly inject the object dependencies. In spring, developers can implement the autowiring functionality with the traditionally XML based or the annotation based configuration. This tutorial will explore the different auto-wiring modes ...

Read More »

20 Spring Framework Best Practices

Spring Application Framework has been in action for quite a long time, and programmers have developed several conventions, usage patterns, and idioms during that time period. In this example, we will try to explain some of them and give examples to illustrate how to apply them in your projects. Let’s begin. Table Of Contents 1. Define singleton beans with names ...

Read More »

Spring Autowire Example

In this example we shall show you how to use Spring Autowiring features to wire beans in other beans. The Spring container can autowire relationships between collaborating beans. Spring offers the auto-wiring modes below: Auto-Wiring ‘no’ : It is the default mode that includes no autowiring. Bean references must be defined via a ref element. Changing the default setting is ...

Read More »