Creating Your First Application
Build a basic 'Hello World' application using Spring Initializr and explore the project structure.
Creating Your First Application is a free Spring Boot 4 Complete Guide lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Spring Boot 4 Complete Guide learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.
Your First Spring Boot App
Time to build your first app! You'll use Spring Initializr to scaffold a project, then create a simple Hello World and explore its structure.
Meet Spring Initializr
Spring Initializr is a project wizard for Spring. Pick your build tool, language, and version, and it generates the boilerplate so you don't have to.
Launching Initializr
Open Spring Initializr at start.spring.io in your browser. IntelliJ and Eclipse also bundle it right into their New Project dialog.
Project Details
In Initializr you set the basics: build tool (Maven), language (Java), Spring Boot version, plus Group and Artifact to name your project and package.
Core Dependencies
Dependencies are the libraries your app needs. Add Spring Web — it brings everything for web apps, including an embedded Tomcat. Search and add it now.
Generate & Open
Hit Generate to download a zip, unzip it, and import it into your IDE. It'll recognize the Maven project and set things up automatically.
Exploring Your Project
Know your layout: src/main/java for code, src/main/resources for config and assets, src/test/java for tests, and pom.xml for dependencies and build settings.
The Core Class
Your main class is the entry point. It carries @SpringBootApplication and a standard main method that calls SpringApplication.run() to boot the app.
Run Your First App!
Let's print a message at startup using a CommandLineRunner — a component that runs your code right after the application context loads.
package com.example.myfirstapp;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@SpringBootApplication
public class MyfirstappApplication {
public static void main(String[] args) {
SpringApplication.run(MyfirstappApplication.class, args);
}
@Bean
public CommandLineRunner run(String... args) throws Exception {
return args -> System.out.println("Hello CoddyKit!");
}
}Project Structure Check
Which of these files/folders is typically found in a newly generated Spring Boot project and is used to define its dependencies?
Recap: Your First App
Done! You scaffolded a project with Spring Initializr, added Spring Web, explored the structure, and printed Hello World via a CommandLineRunner. Next: auto-configuration in depth.
Frequently asked questions
Is the “Creating Your First Application” lesson free?
Yes — the full text of “Creating Your First Application” is free to read here on the web, and the Spring Boot 4 Complete Guide course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Spring Boot 4 Complete Guide course, upgrade to CoddyKit PRO.
What will I learn in “Creating Your First Application”?
Build a basic 'Hello World' application using Spring Initializr and explore the project structure. You practise Spring Boot 4 Complete Guide with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.
Do I need any experience to start Spring Boot 4 Complete Guide?
No prior experience is required. Spring Boot 4 Complete Guide on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.
How long does the “Creating Your First Application” lesson take?
Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.
Can I write and run code in this Spring Boot 4 Complete Guide lesson?
Yes. Every Spring Boot 4 Complete Guide lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.
All lessons in this course
- Introduction to Spring Boot 4
- Creating Your First Application
- Spring Boot Auto-Configuration
- Understanding the Spring Boot Project Structure