Welcome to the Spring Framework Masterclass repository! This project is a comprehensive collection of sub-modules demonstrating various core concepts of the Spring Framework, ranging from fundamental Inversion of Control (IoC) to database integration using JDBC and ORM.
This repository is structured as a multi-module Maven project. Each module focuses on a specific set of Spring features, providing practical examples and clear configurations (both XML-based and Annotation-based).
This module covers the foundational features of the Spring Framework, heavily focusing on Dependency Injection (DI) and the Inversion of Control (IoC) container.
- Dependency Injection: Constructor Injection (
ci), Setter Injection, Reference Injection (ref), and Collection Injection. - Autowiring: Examples of autowiring dependencies using both XML configurations and Annotations (
@Autowired). - Bean Lifecycle: Understanding bean initialization and destruction using:
- XML configuration (
init-method&destroy-method) - Spring Interfaces (
InitializingBean&DisposableBean) - JSR-250 Annotations (
@PostConstruct&@PreDestroy)
- XML configuration (
- Configuration Types: Transitioning from traditional XML configurations to pure Java-based configuration (
removingXML/JavaConfig). - Advanced Core Features: Standalone Collections, Spring Expression Language (SpEL), and Stereotype Annotations (
@Component,@Value).
This module demonstrates how to interact with a relational database (MySQL) using Spring's JDBC abstraction framework.
- JdbcTemplate: Performing CRUD operations using
JdbcTemplatewithout standard boilerplate. - RowMapper: Mapping database rows to Java objects using custom
RowMapperimplementations. - Design Patterns: Utilizing the DAO (Data Access Object) pattern.
- Configuration: Setting up data sources and JDBC templates using both XML specifications and pure Java Configurations.
This module explores Spring's Object-Relational Mapping (ORM) integration, specifically using Hibernate.
- Hibernate Integration: Configuring
HibernateTemplateandLocalSessionFactoryBeanin Spring. - Database Operations: Seamlessly performing database CRUD operations mapped to Java entities.
- Lombok: Using Project Lombok to reduce boilerplate code in Entity classes.
- Java: Primary programming language.
- Spring Framework:
spring-core,spring-context,spring-jdbc,spring-orm(Version 6.2.1) - Database: MySQL Server (
mysql-connector-java8.0.33) - ORM: Hibernate Core (Version 5.6.15.Final)
- Build Tool: Maven
- Ensure you have Java and Maven installed on your machine.
- Set up a local MySQL database and configure the necessary schemas and tables as expected by the entities in
springJdbcandspringorm. - Update the database credentials (username, password, URL) in the respective
config.xmlorJavaConfigfiles across the JDBC and ORM modules. - Run the individual
App.javaortest.javafiles located within the specific package of the concept you want to explore.
Happy Learning and Coding with Spring! ๐ฑ