Spring Core Tutorial


This tutorial covers the core spring concepts with implementation examples.
The source code examples of each article are developed using latest Spring 5.1.0 RELEASE, JDK 8 and Maven 3.2+.
Note that Java 8 is the minimum requirement to work on Spring Framework 5.0.

Spring IOC Container

1. Spring IOC Container Overview
In this article, we will discuss what Spring IOC container, how it works, how to create Spring IOC container, how to retrieve beans from Spring IOC container with examples.

2. Spring IOC Container Java Config Example
In this article, we will discuss a simple example to demonstrate the working of Spring IOC Container with Java-based configuration metadata?

3. Spring IOC Container XML Config Example
In this article, we will discuss a simple example to demonstrate the working of Spring IOC Container with XML-based configuration metadata?

4. Spring BeanFactory Interface Example
In this quick article, we will discuss the Spring BeanFactory interface with an example.

Spring Dependency Injection

5. Guide to Dependency Injection in Spring
This guide provides what is dependency injection in Spring framework and what are different types of dependency injection supports in Spring with examples (constructor and setter method).

6. Spring Dependency Injection via Setter Example
In this article, we will learn how to use setter-based dependency injection in Spring Applications.

7. Spring Dependency Injection via Constructor Example
In this article, we will learn how to use constructor-based dependency injection in Spring Applications.

8. Spring - @DependsOn Annotation Example
In this article, we will discuss how to use @DependsOn annotation in Spring Applications with an example. The @DependsOn annotation can force Spring IoC container to initialize one or more beans before the bean which is annotated by @DependsOn annotation.

Spring Bean Scopes

9. Guide to Spring Bean Scopes
This guide provides you what are different Spring bean scopes with examples.

10. Singleton and Prototype Bean Scopes Examples
In this article, we will discuss what is a difference between Singleton and Prototype scope with a source code example.

11. Spring InitializingBean and DisposableBean Example
This post guides you how to interact with the container’s management of the bean lifecycle by implementing Spring InitializingBean and DisposableBean interfaces.

12. Spring @Bean’s initMethod and destroyMethod Attributes Example
In this article, we will discuss how to use initMethod and destroyMethod attributes of the @Bean annotation to perform certain actions after bean initialization or before bean destruction by a container.

13. Spring @Scope annotation with Prototype Scope Example
In this article, we will discuss how to create a bean, scoped as a prototype, using the @Scope annotation.

14. Spring @Scope annotation with Singleton Scope Example
In this article, we will discuss how to create a bean, scoped as a singleton, using the @Scope annotation.

Annotation-based Container Configuration

15. Spring Annotation Based Container Configuration
In this article, we will briefly discuss different annotations that Spring provides to support annotation-based container configuration.

16. Spring @Autowired Annotation with Example
In this article, we will discuss a very important Spring dependency injection annotation that is a @Autowired annotation.

17. Spring - @Primary Annotation Example
In this quick article, we’ll discuss Spring’s @Primary annotation which was introduced with version 3.0 of the framework. @Primary to give higher preference to a bean when there are multiple beans of the same type.

18. Spring @PostConstruct and @PreDestroy Example
In this article, we will discuss how to use method-level annotations @PostConstruct and @PreDestroy to customize the nature of a Bean.

19. Spring @Qualifier Annotation Example
In this example, we will see how to use @Qualifier annotation to resolve ambiguous dependencies.

Java-based Container Configuration

20. Spring Java Based Configuration Basics
In this article, we will briefly look into basics of Spring Java-based container configuration.

21. Spring Java Based Configuration Example
In this post, we will demonstrate the usage of Spring Java-based container configuration.

22. Spring @Bean Annotation with Example
In this article, we will discuss Spring Java configuration based @Bean annotation with examples. We will also discuss different scenarios of how and when to use @Bean annotation.

23. Spring @Configuration Annotation with Example
In this article, we will discuss a very important Spring Java based configuration annotation that is a @Configuration annotation with examples.

24. Spring @PropertySource Annotation with Example
In Spring, you can use @PropertySource annotation to externalize your configuration to a properties file. In this article, we will discuss how to use @PropertySource to read a properties file and display the values with @Value and Environment.


25. Spring @Import Annotation with Example
In this article, we will discuss how to use Spring @Import annotation with examples.

26. Spring @ImportResource Annotation Example
In this article, we will quickly discuss how to use @ImportResource annotation with a simple Spring boot application.

27. Spring - @Lazy Annotation Example
In this quick article, we’ll discuss Spring’s @Lazy annotation with an example. By default, the Spring IoC container creates and initializes all singleton beans at time of application startup. We can prevent this pre-initialization of a singleton bean by using the @Lazy annotation.

In this quick article, we will discuss Spring core annotations that are used in Spring DI and Spring IOC.

GitHub Repository

https://github.com/RameshMF/spring-core-tutorial

Further Reading:

Comments