Skip to content

My 'learn by doing' journey with Spring Boot. This single repository is a practical, hands-on project that evolved as I learned, integrating concepts from Spring Core, MVC, Security, Data JPA, and more.

Notifications You must be signed in to change notification settings

Shivam56291/Spring-LearningByDoing-EazySchool

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spring-LearningByDoing-EazySchool

Spring Boot Maven MySQL

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.

📚 Topics & Concepts Covered

This project is a comprehensive application that covers the following major areas of the Spring Framework:

1. Spring Core

  • 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)

2. Aspect-Oriented Programming (AOP)

  • Understanding AOP Jargons (Aspect, JoinPoint, Advice)
  • Types of Advices: @Around, @Before, @AfterThrowing, @AfterReturning
  • Implementing AOP for logging and performance monitoring.

3. Spring MVC & Web Applications

  • Introduction to Spring Boot & its features (Auto-configuration, DevTools)
  • Building Web Apps with @Controller
  • Dynamic content with Thymeleaf (Templates, Layouts)
  • Handling requests with @RequestParam and @PathVariable
  • Java Bean Validations (@Valid) and Custom Validations
  • Global Exception Handling with @ControllerAdvice and @ExceptionHandler
  • Web Scopes (@RequestScope, @SessionScope)

4. Spring Security

  • 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.

5. Database & Spring Data

  • 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)

6. RESTful Services

  • Building REST APIs with @RestController
  • @RequestBody, @ResponseBody, ResponseEntity
  • Handling CORS (@CrossOrigin)
  • Consuming REST services using RestTemplate, WebClient, and OpenFeign
  • Spring Data REST & HAL Explorer

7. Spring Boot Features

  • 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)

🛠️ Prerequisites

  • JDK 11 or higher
  • Apache Maven
  • An IDE (like IntelliJ IDEA or Eclipse)
  • A MySQL database server

🚀 How to Run This Project

This project requires manual configuration for the database to run.

  1. 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
  2. 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
  3. Activate the Profile: By default, the application might use the in-memory H2 database (dev profile). To run it with your MySQL database, you need to activate the prod profile.

    • Open src/main/resources/application.properties.
    • Set the active profile to prod:
    spring.profiles.active=prod
  4. Run the application: You can run the application using your IDE's "Run" command on the main EazySchoolApplication class or via the Maven command line:

    mvn spring-boot:run
  5. Access the application: Open your browser and navigate to http://localhost:8080.


💡 Project Notes

  • 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 dev profile, you can access the H2 in-memory database console at http://localhost:8080/h2-console.

About

My 'learn by doing' journey with Spring Boot. This single repository is a practical, hands-on project that evolved as I learned, integrating concepts from Spring Core, MVC, Security, Data JPA, and more.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published