Learnitweb

Author: Editorial Team

  • Spring IoC Container

    One of the most important topic when we start learning Spring is Spring IoC container. We need to understand what a Spring IoC Container is, and how does it work, to understand how Spring works. We’ll understand this by answering few important questions about Spring IoC container. What is Spring IoC Container? Spring IoC container…

  • Setter Based Dependency Injection in Spring

    In this article, we’ll discuss Setter-Based Dependency Injection within Spring. Setter-based dependency is accomplished by the container calling setter methods on beans after invoking a no-argument constructor or a no-argument static factory method to instantiate your bean. Let us now understand setter-based dependency injection with the help of an example. Suppose we have a car.…

  • Constructor Based Dependency Injection in Spring

    1. Introduction to constructor-based dependency injection In this article, we’ll discuss Constructor-Based Dependency Injection within Spring. This type of dependency injection means – the required dependencies are passed into a class at the time of creation of object (or instantiation). The fields or member variables in a class are the dependencies which a class needs.…

  • Hello World in Spring using XML Configuration and Annotation

    1. Getting started with Spring To start with Spring, we should have Spring JAR files. There are two ways to get Spring JAR files: Download the JAR files. The URL at the time of writing this tutorial is https://repo.spring.io/release/org/springframework/spring/. Checkout the latest code from GitHub repository and build JARs. Spring packaging of JARs is modular.…

  • Introduction to Spring Framework

    Spring was developed by Rod Johnson. The first version of Spring was released in October 2002. Spring is a lightweight framework for creating Java applications. Spring can be used to create web as well as stand-alone Java application. In the above statement, when we say that Spring is lightweight, we don’t mean to say that…

  • How to split a string into an list of characters in Python?

    We’ll discuss following ways to convert string into an array of characters: Using list constructor Using list comprehension Using map and lambda Using for loop Unpacking into an empty list Using extend() method Method 1: Using list constructor The list constructor takes a single argument which is iterable. You can pass a sequence, collection or…

  • Python program to find sum of elements in a list

    We’ll see different ways to find sum of elements in a list. The requirement is that if a list contains numbers, then find the sum of all the elements in the list. We’ll discuss four ways to find the sum of all the elements in the list: Using sum() method Using for loop Using while…

  • How to clear a list in Python

    We’ll discuss different ways to clear a list in Python. The 4 ways which we’ll discuss to clear the list are: Using clear() method Using *= 0 Using del() method Reinitializing the list Method 1: Using clear() method We can use clear() method to clear the list. Output Method 2: Using *=0 This is not…

  • volatile keyword in Java

    Marking a variable as volatile is a weaker form of synchronization. Volatile variable always returns the most recent value of the variable written by any thread as volatile variables are not cached in registers or in caches. Volatile variables may look like to behave like Synchronized classes (for example, SynchronizedInteger), but it is not. Synchronized…

  • Static Nested Class in Java

    A static nested class is an inner class marked with static modifier. A static nested class is sometimes called as static inner class. A static nested class does not have a relationship with the outer class as it can not access instance non static members of the outer class. This is because the nested class…