Lecture 40: Spring Boot Actuator, Logger, Web App Build & Final Revision

BMC201 - Web Technology

Mr. Prashant Kumar Nag

2026-03-30

Lecture 40

Spring Boot Actuator, Logger, Web App Build & Final Revision

Week 12 | Unit V: Final Revision
BMC201 - Web Technology
Mr. Prashant Kumar Nag, Assistant Professor

Learning Objectives


  • Enable and use Spring Boot Actuator endpoints
  • Configure structured logging and log levels by environment
  • Prepare a Spring Boot app for packaging and deployment
  • Review production checklist: health, security, observability
  • Consolidate Unit V concepts before final exam/project

Actuator Endpoint Basics


management.endpoints.web.exposure.include=health,info,metrics,env,loggers
management.endpoint.health.show-details=always
management.server.port=8082
GET /actuator/health
GET /actuator/info
GET /actuator/metrics
GET /actuator/env
GET /actuator/loggers

Operational Monitoring Use Cases


  • Detect DB/network outages via health endpoint
  • Monitor request latency and JVM memory usage
  • Verify active profiles and runtime environment
  • Change logger level at runtime for debugging

Logging Best Practices


logging.level.root=INFO
logging.level.com.example=DEBUG
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss} %-5level [%thread] %logger{36} - %msg%n
private static final Logger log = LoggerFactory.getLogger(UserService.class);

log.info("Creating user: {}", req.getUsername());
log.warn("Duplicate email attempted: {}", req.getEmail());
log.error("Payment service unavailable", ex);

Build and Package


# Maven
mvn clean package
java -jar target/app-0.0.1-SNAPSHOT.jar

# Gradle
gradle clean build
java -jar build/libs/app-0.0.1-SNAPSHOT.jar

Create reproducible builds and lock dependency versions for stable deployments.

Deployment Options


Option Typical Use
VPS / VM Full control, manual ops
Docker container Consistent runtime portability
PaaS (Render, Railway, Heroku-like) Fast deployment for student projects
Kubernetes Scalable enterprise orchestration

Dockerizing Spring Boot


FROM eclipse-temurin:21-jre
WORKDIR /app
COPY target/app.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "/app/app.jar"]
docker build -t webtech-app:1.0 .
docker run -p 8080:8080 webtech-app:1.0

Production Readiness Checklist


  • Secrets externalized (env vars / vault), not in source code
  • Actuator endpoints secured and minimally exposed
  • DB migrations versioned (Flyway/Liquibase)
  • Global error handling enabled
  • Logs centralized and searchable
  • Backups and basic alerting configured

Unit V Final Revision Map


flowchart LR
  A[Spring Boot Setup] --> B[Configuration + Profiles]
  B --> C[REST Controllers + CRUD]
  C --> D[Validation + Exception Handling]
  D --> E[Actuator + Logging]
  E --> F[Packaging + Deployment]

High-Probability Viva Questions


  1. Difference between @Controller and @RestController?
  2. Why do we use @Valid in REST API inputs?
  3. When should you return 201, 204, and 404?
  4. What actuator endpoints are safe to expose publicly?
  5. How do profiles help in deployment?

Summary


  • Actuator + logging transform app into an observable service
  • Deployment readiness requires security + reliability practices
  • Unit V combines configuration, APIs, monitoring, and delivery
  • You are now exam-ready and project-ready for full-stack backend work

Thank You

Course Wrap-up: All the best for final project and end-sem exam