This repository is my Spring Boot learning journal in code. It's a single, evolving project based on the EazySchool web application, where I've applied every concept I've learned, from core principles to advanced features. This is a practical, 'learn by doing' approach to mastering the Spring Framework.
This project is a comprehensive application that covers the following major areas of the Spring Framework:
- Inversion of Control (IoC) & Dependency Injection (DI)
- Spring Context & Beans (
@Bean,@Component, Stereotype Annotations) - Bean Lifecycle (
@PostConstruct,@PreDestroy) & Scopes (Singleton, Prototype) - Autowiring (Field, Setter, Constructor) & Circular Dependencies
- Configuration (XML & Annotation-based)
- Understanding AOP Jargons (Aspect, JoinPoint, Advice)
- Types of Advices:
@Around,@Before,@AfterThrowing,@AfterReturning - Implementing AOP for logging and performance monitoring.
- Introduction to Spring Boot & its features (Auto-configuration, DevTools)
- Building Web Apps with
@Controller - Dynamic content with Thymeleaf (Templates, Layouts)
- Handling requests with
@RequestParamand@PathVariable - Java Bean Validations (
@Valid) and Custom Validations - Global Exception Handling with
@ControllerAdviceand@ExceptionHandler - Web Scopes (
@RequestScope,@SessionScope)
- Authentication vs. Authorization
- In-Memory & JDBC-based Authentication
- Custom Login/Logout functionality
- Securing web pages and endpoints (
permitAll,denyAll) - CSRF Protection & implementation
- Password Hashing with BCryptPasswordEncoder
- Thymeleaf-Security integration for dynamic UI.
- Spring JDBC:
JdbcTemplate(Insert, Update, Select) - Databases: H2 (In-memory) & MySQL
- Spring Data JPA:
JpaRepository,CrudRepository - ORM Concepts (Fetch Types, Cascade Types)
- Entity Relationships:
@OneToOne,@OneToMany,@ManyToMany - JPA Auditing (
@CreatedBy,@LastModifiedDate) - Advanced Queries: Static/Dynamic Sorting, Pagination, Custom Queries (
@Query,@NamedQuery)
- Building REST APIs with
@RestController @RequestBody,@ResponseBody,ResponseEntity- Handling CORS (
@CrossOrigin) - Consuming REST services using
RestTemplate,WebClient, and OpenFeign - Spring Data REST & HAL Explorer
- Logging (Logback configurations)
- Externalized Properties (
@Value,@ConfigurationProperties) - Profiles (
application-dev.properties,application-prod.properties) - Spring Boot Actuator (Health, Metrics, Info)
- Spring Boot Admin (Monitoring UI)
- JDK 11 or higher
- Apache Maven
- An IDE (like IntelliJ IDEA or Eclipse)
- A MySQL database server
This project requires manual configuration for the database to run.
-
Clone the repository:
git clone [https://github.com/YOUR_USERNAME/Spring-LearningByDoing-EazySchool.git](https://github.com/YOUR_USERNAME/Spring-LearningByDoing-EazySchool.git) cd Spring-LearningByDoing-EazySchool -
Database Configuration: This project is configured to use MySQL for its production profile. You must create a MySQL database and update the database credentials.
- Open
src/main/resources/application-prod.properties. - Update the following properties with your own MySQL server details:
spring.datasource.url=jdbc:mysql://localhost:3306/your_db_name spring.datasource.username=your_username spring.datasource.password=your_password
- Open
-
Activate the Profile: By default, the application might use the in-memory H2 database (
devprofile). To run it with your MySQL database, you need to activate theprodprofile.- Open
src/main/resources/application.properties. - Set the active profile to
prod:
spring.profiles.active=prod - Open
-
Run the application: You can run the application using your IDE's "Run" command on the main
EazySchoolApplicationclass or via the Maven command line:mvn spring-boot:run
-
Access the application: Open your browser and navigate to
http://localhost:8080.
- AWS Deployment: The original learning path included modules on deploying to AWS Elastic Beanstalk. However, I did not complete this final deployment step as it required a credit card to create an AWS account. The project is fully built and functional for local or other deployment methods.
- H2 Console: If you run with the
devprofile, you can access the H2 in-memory database console athttp://localhost:8080/h2-console.