Spring Initializr
Spring Initializr (start.spring.io) is the official project generator.
Introduction
Spring Initializr (start.spring.io) is the official project generator. You choose build system, language, Boot version, Java version, and starters; it returns a zip with a runnable skeleton, wrapper scripts, and a sensible .gitignore.
For Orders, pick Maven, Java, a current Spring Boot 3.x release (not a milestone for production labs), packaging Jar, and Java 21. Start with web, validation, and actuator. Add data-jpa and a database driver when the Data module begins — not on day one if you are still learning HTTP.
Initializr is also an HTTP API. Teams generate projects in CI with curl so scaffolds are reviewable and repeatable.
Every starter expands the classpath and the auto-configuration surface. More checkboxes are not progress.
Purpose of this lesson
Generate the TechLearningPRO Orders skeleton with the correct Boot 3 / Java 21 coordinates and a minimal starter set you can defend in review.
Understanding the topic
Choices that matter on the Initializr form.
- Boot version: latest stable 3.x line your org allows; avoid snapshots for course labs.
- Group / artifact: e.g.
com.techlearningpro/orders. - Packaging: Jar for services; War only if you must deploy to a legacy app server.
- Starters: web + validation + actuator for Fundamentals; persistence later.
- Metadata: the generated POM imports the Boot BOM — do not delete the parent without a plan.
Step-by-step explanation
- Open start.spring.io (or use the curl recipe below).
- Set Java 21, Boot 3.x, Maven, Jar, group
com.techlearningpro, artifactorders. - Add dependencies: Web, Validation, Actuator.
- Download, unzip, and run
./mvnw -q testto prove the skeleton builds.
Syntax reference
CI-friendly generation (adjust bootVersion to a current 3.x release from the Initializr UI):
curl https://start.spring.io/starter.zip \-d type=maven-project \-d language=java \-d bootVersion=3.3.5 \-d groupId=com.techlearningpro \-d artifactId=orders \-d name=orders \-d packageName=com.techlearningpro.orders \-d javaVersion=21 \-d dependencies=web,validation,actuator \-o orders.zipunzip orders.zip -d orderscd orders && ./mvnw -q test
Real-world use
Platform teams wrap Initializr (or a company fork) so every new service gets the same parent BOM, logging style, and Actuator defaults. Orders should look like those services: boring, consistent, reviewable diffs.
Security implications
Actuator on a fresh project can expose more than health.
- Plan authentication and exposure for Actuator before any shared environment.
- Do not bake secrets into the generated
application.properties. - Review the dependency tree when you add starters — supply-chain surface grows quickly.
Best practices
- Generate with curl in docs so onboarding is copy-paste reproducible.
- Commit the wrapper immediately.
- Add starters when a lesson needs them, not before.
Common mistakes
- Selecting milestones or snapshots for a learning production-shaped lab.
- Adding JPA, Security, Kafka, and Batch on day one — debugging becomes impossible.
- Hand-editing the POM to random dependency versions that fight the Boot BOM.
Advanced interview questions
Interview Prep
Practice concise answers, then expand each card for the explanation.
1BeginnerQuestionWhat does Spring Initializr produce?+
Answer
spring-boot:run.2IntermediateQuestionWhy avoid selecting every dependency on the form?+
Answer
3AdvancedQuestionHow do companies make Initializr repeatable?+
Answer
Hands-on exercise
Lab. Generate Orders with web, validation, and actuator only. Confirm ./mvnw test passes and list the starters in the POM. Do not add JPA yet.
Summary
Initializr gives Orders a boring, correct skeleton. Next you learn where each file lives and why the scan root matters.