Spring 4 Tutorial

Learn Spring 4 framework basic and advanced concepts with simple step-by-step examples. This series of Spring tutorial is based on new Spring framework version 4.


Spring is a framework designed to simply Java development. It’s a lightweight container which promotes POJO based development, loose coupling through dependency injection and coding to interfaces. Spring provides easy integration with most of the technologies out there in Java/JEE development landscape.

This Spring 4 Tutorial series is based on Spring 4.0.6.RELEASE and above.


Spring 4 Hands-on Examples

In this tutorial series, we will go through the common features of Spring, exploring them with help of fully-working examples.

For Spring Boot, please refer to our Spring Boot tutorials.

For AngularJS, please refer to our AngularJS tutorials.

For Spring 4 MVC, please refer to our Spring 4 MVC tutorials.

For Spring 4 Security, please refer to our Spring 4 Security tutorials.

For Spring Batch, please refer to our Spring Batch tutorials.

For Hibernate, please refer to our Hibernate 4 tutorials.

Spring 4 Basics

Spring 4 Hello World Example
Simple HelloWorld java application explaining basic setup of a typical Spring based application, using Spring Annotation based configuration. XML configuration is also discussed side-by-side for comparison.

Spring Dependency Injection with Constructor and Property Setter (XML Example)
Tutorial explaining Spring Dependency injection using Property Setter as well as Constructor Injection based on Spring XML configuration.

Spring Beans Auto-wiring Example using XML configuration
Tutorial explaining different types of auto-wiring available in Spring, using XML based configuration.

Spring Dependency-Injection Annotation Example & Autowiring using @Autowired, @Qualifier & @Resource annotations configuration
Tutorial explaining Spring Dependency injection and Autowiring using different available annotations (@Autowired, @Qualifier and @Reosource) on field, method or constructor level, using Annotation based configuration.

Spring Auto-detection & Component Scanning Example With Annotations
Tutorial explaining how Spring can auto-detect the beans configured in your application through component-scanning, wire them where required without even declaring as @Bean methods in @Configuration class. XML configuration is also discussed side-by-side for comparison.

Spring @PropertySource & @Value annotations example
Tutorial explaining how to read properties from properties files in a java application using Spring @PropertySource & @Value annotations along with Spring Environment interface. XML configuration is also discussed side-by-side for comparison.

Spring @Profiles Example
In this tutorial we will explore Spring @Profile annotation to make different set of beans or configuration available conditionally on different environments. XML configuration is also discussed side-by-side for comparison.

Spring 4 + Hibernate

Spring4 + Hibernate4 + MySQL + Maven integration example using annotations
Annotation based Hibernate and Spring Configuration example, creating a simple java application showing usage of AOP based transaction management, CRUD operations on database, all with annotations. We will also see corresponding XML configuration side-by-side for comparison.

Spring 4 + Job Schedulers

Spring Job Scheduling using XML Configuration
Schedule job using Spring scheduler with XML based configuration.

Spring Job Scheduling with @Scheduled & @EnableScheduling Annotations
Schedule job using Spring scheduler with Annotation based configuration.

Spring 4 + Quartz Scheduler Integration Example
Schedule job using more flexible Quartz Scheduler and Spring.

Spring 4 + JMS

Spring 4+JMS+ActiveMQ Example with Annotations
Integrate Spring based applications using JMS with ActiveMQ as JMS provider. Annotaiton based example.

Spring 4+JMS+ActiveMQ Example with @JmsListener, @EnableJms & JmsListenerContainerFactory
Integrate Spring based applications using JMS with ActiveMQ as JMS provider. Alternatve to javax.jms.MessageListener, @JmsListener enables a POJO to act as a listener.

Spring 4 + Email

Spring 4 Email Integration Tutorial with Annotations
Send Emails right from within your Spring based application. Detailed annotation based example showing the necessary configuration and step, sending mail using Spring 4 JavaMailSender and MimeMessagePreparator.

Spring 4 Email With Attachment Tutorial
Send Email with attachments using Spring 4 JavaMailSender , MimeMessagePreparator & MimeMessageHelper. Annotations based Spring 4 Email tutorial.

Spring 4 Email using Velocity,Freemaker Template library
Prepare Email using Velocity/Freemarker templates, send Emails using Spring 4 JavaMailSender , MimeMessagePreparator & MimeMessageHelper.

Spring 4 + Caching

Spring 4 Cache Tutorial with EhCache
Spring 4 Caching Tutorial using EhCache. Learn basics and advanced details of Caching, with EhCache as caching provider, annotations based example.

Spring 4 Caching Annotations Tutorial
Spring 4 Caching Annotations tutorial, with detailed examples for @Cacheable, @CachePut, @CacheEvict, @Caching, @CacheConfig & @EnableCaching.

References

View Comments