
👍Java Spring Boot & Microservice Realtime Project development CT👍
June 10, 2025 at 11:09 AM
*5Tasks for today: 10Jun*
✅ 1. Understand the framework used for Data Access & for Enterprise application.
✅ 2. Get SpringBoot concepts that we discussed today. Rapid App Dev, Starts, Embeded Tomcat
✅ 3. Understand what are microservices, and background of how Martin Fowler & James Lewis came up with 9 attributes of microservices. Explore chatgpt & internet for more of this.
✅ 4. Setup software to execute 1st spring boot application. Setup IDE, Java17, Postman
✅ 5. Create 1st spring boot app & Add functionality in Restful Webservice.
===========================================
1. Understand the framework used for Data Access & for Enterprise application.
- Database access in Java is done using JDBC, but for structured SQL-style coding, developers use either ORM frameworks (like Hibernate) or SQL frameworks.
- Spring provides modules for both styles: spring-orm (wrapper over Hibernate) for ORM-based logic, and spring-jdbc for SQL-style persistence.
- Spring Data JPA is the modern ORM solution in Spring, preferred for most applications, while spring-orm is used when fine-tuned configuration is required.
- Direct use of Hibernate is declining in Spring-based projects because Spring's modules offer simpler and more integrated solutions.
- Spring Data JDBC enhances spring-jdbc with extra features and ease of use, ensuring projects choose the right framework based on their needs.
Enterprise framework
An enterprise application is a large-scale, complex software system designed to support critical business operations and processes across an organization. It is typically distributed in nature, operating across multiple systems and locations to ensure scalability, reliability, and seamless integration with various services.
To build such applications, Spring is the primary framework available in market.
=====================================
2. Get SpringBoot concepts that we discussed today. Rapid App Dev, Starts, Embeded Tomcat
- Spring Boot is for rapid application development.
- Using spring boot, you can build any other application of spring, in faster manner.
It offers features, like starters, auto configuration, embedded tomcat, prod read applications.
Explore how spring-boot-starter-web is setup in spring-boot.
https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-starters/spring-boot-starter-web/build.gradle
Know that spring boot is one of the project of spring.
Its built on core spring framework.
Rest of spring boot concepts we will understand practically in upcoming connects.
Spring boot features:
https://spring.io/projects/spring-boot
=====================
3. Understand what are microservices, and background of how Martin Fowler & James Lewis came up with 9 attributes of microservices. Explore chatgpt & internet for more of this.
In short, the microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies.
9 Key attributes of Microservices as outlines in Martin Fowler's article
Componentization via Services
Organized around Business Capabilities
Smart endpoints and dumb pipes
Design for failure
Decentralized Data Management
Infrastructure Automation
Decentralized Governance
Products not Projects
Evolutionary Design
Microservice document:
https://docs.google.com/document/d/1cVDrJ94WwvhMRxmRrt42EEAgcTsfhkcQnQx9uoWJUuA/edit?usp=drive_link
============================
4. Setup software to execute 1st spring boot application. Setup IDE, Java17, Postman
Download & setup below
IDE: Setup Eclipse STS (you can use other one, that you are comfortable with)
https://spring.io/tools
Java 17:
https://www.oracle.com/java/technologies/downloads/#java17
PostMan - API Testing
https://www.postman.com/downloads/
Explore using AI & internet for any problem solving.
===========================
5. Create 1st spring boot app & Add functionality in Restful Webservice.
- Create 1st app from https://start.spring.io/
- download zip & Extract
- Import Existing maven project in IDE (choose proper workspace)
- Understand the project structure.
- Update pom.xml to use http in header for https
- Use maven commands to build & start spring boot app
clean package,
clean spring-boot:run
When you use in Goal, then don't pass "mvn" command. directly run "clean package"
- Note that when spring boot app comes up, it starts on Tomcat server on default port 8080.
- You can access this spring-boot app using http://localhost:8080
Is anycode running on port 8080 in localhost machine which is accessible via http protocol
Add a Controller where you can add 2 int & return int value.
Build this code from ChatGPT
package com.mycomp.firstapp.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class AdditionController {
// Example: GET /api/add?num1=10&num2=20
@GetMapping("/add")
public int addNumbers(@RequestParam int num1, @RequestParam int num2) {
return num1 + num2;
}
}
Test it here:
http://localhost:8080/api/add?num1=10&num2=30